Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/@types/cdp-lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* cdp-lib.d.ts
* This file is generated by the CDP package build process.
*
* Date: 2017-11-06T05:53:50.619Z
* Date: 2017-11-15T03:44:27.505Z
*/
// Dependencies for this module:
// ../fs-extra
Expand Down
14 changes: 12 additions & 2 deletions dist/cdp-lib.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/cdp-lib.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cdp-lib.min.js.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ export function execCommand(command: string, args: string[], options?: ExecComma
stderr: (data: string): void => { /* noop */ },
}, options);

// on win32, command and args need to be quoted if containing spaces
const quoteIfNeeded = (str: string): string => {
if ("win32" === os.platform() && str.includes(" ")) {
str = "\"" + str + "\"";
opt.shell = true;
}
return str;
};

which(command, (error, resolvedCommand) => {
if (error) {
handleError(JSON.stringify(error));
Expand All @@ -174,6 +183,8 @@ export function execCommand(command: string, args: string[], options?: ExecComma
spinner.start();
}

resolvedCommand = quoteIfNeeded(resolvedCommand);
args = args.map(quoteIfNeeded);
const child = spawn(resolvedCommand, args, opt)
.on("error", handleError)
.on("close", (code) => {
Expand Down