Skip to content

Commit db7a35b

Browse files
committed
Use spawn instead of exec
Throw Errors instead of strings Bump version
1 parent 84a4aac commit db7a35b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

lib/child-process.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function exec(command: string): IFuture<any> {
1111

1212
child_process.exec(command, (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) => {
1313
if(error) {
14-
errors.fail(`Error ${error.message} while executing ${command}.`);
14+
future.throw(new Error(`Error ${error.message} while executing ${command}.`));
1515
} else {
1616
future.return(stdout ? stdout.toString() : "");
1717
}
@@ -44,7 +44,7 @@ export function spawn(command: string, args: string[]): IFuture<string> {
4444
if(exitCode === 0) {
4545
future.return(capturedOut ? capturedOut.trim() : null);
4646
} else {
47-
future.throw(util.format("Command %s with arguments %s failed with exit code %s. Error output: \n %s", command, args.join(" "), exitCode, capturedErr));
47+
future.throw(new Error(util.format("Command %s with arguments %s failed with exit code %s. Error output:\n %s", command, args.join(" "), exitCode, capturedErr)));
4848
}
4949
});
5050

lib/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path="./.d.ts"/>
22
"use strict";
33

4-
import util = require("util");
4+
import * as util from "util";
55

66
export function fail(errorMessage: string, ...args: string[]) {
77
args.unshift(errorMessage);

lib/simctl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class Simctl implements ISimctl {
114114
}
115115

116116
private simctlExec(command: string, args: string[]): IFuture<any> {
117-
args = ["xcrun", "simctl", command, ...args];
118-
return childProcess.exec(args.join(" "));
117+
args = ["simctl", command, ...args];
118+
return childProcess.spawn("xcrun", args);
119119
}
120-
}
120+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ios-sim-portable",
3-
"version": "1.0.11-beta",
3+
"version": "1.0.12-beta",
44
"description": "",
55
"main": "./lib/ios-sim.js",
66
"scripts": {

0 commit comments

Comments
 (0)