Skip to content

Commit d79cbfd

Browse files
author
Yosif Yosifov
committed
Use spawn instaed of exec to have the args escaped.
1 parent ee1a6a6 commit d79cbfd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/simctl.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import childProcess = require("./child-process");
2+
import nodeChildProcess = require("child_process");
23
import errors = require("./errors");
34
import options = require("./options");
45
import * as _ from "lodash";
@@ -117,9 +118,6 @@ export class Simctl implements ISimctl {
117118
}
118119

119120
private simctlExec(command: string, args: string[], opts?: any): any {
120-
let escapedArgs = args.map((arg) => `"${arg}"`);
121-
let fullCommand = (["xcrun", "simctl", command].concat(escapedArgs)).join(" ");
122-
123-
return childProcess.execSync(fullCommand, opts).toString().trim();
121+
return nodeChildProcess.spawnSync("xcrun", ["simctl", command].concat(args), opts).stdout.toString().trim();
124122
}
125123
}

0 commit comments

Comments
 (0)