Skip to content

Commit ce7b57e

Browse files
committed
fix windows issue with bin/cli.js
1 parent b825784 commit ce7b57e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bin/cli.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ function escapeArg(arg) {
2323
return arg;
2424
}
2525

26+
function buildCommandWithPort(command, port) {
27+
if (!port) return command;
28+
29+
if (process.platform === 'win32') {
30+
return `set PORT=${port}&& ${command}`;
31+
}
32+
return `PORT=${port} ${command}`;
33+
}
34+
2635
const serverCommand = [
2736
`node`,
2837
inspectorServerPath,
@@ -34,17 +43,18 @@ const serverCommand = [
3443
.filter(Boolean)
3544
.join(" ");
3645

46+
const clientCommand = `node ${inspectorClientPath}`;
3747
const CLIENT_PORT = process.env.CLIENT_PORT ?? "";
3848
const SERVER_PORT = process.env.SERVER_PORT ?? "";
3949

4050
const { result } = concurrently(
4151
[
4252
{
43-
command: `PORT=${SERVER_PORT} ${serverCommand}`,
53+
command: buildCommandWithPort(serverCommand, SERVER_PORT),
4454
name: "server",
4555
},
4656
{
47-
command: `PORT=${CLIENT_PORT} node ${inspectorClientPath}`,
57+
command: buildCommandWithPort(clientCommand, CLIENT_PORT),
4858
name: "client",
4959
},
5060
],

0 commit comments

Comments
 (0)