Skip to content

Commit d5bc0ca

Browse files
committed
Remove process.exit when simctl prerequisite is not present.
The init() function will return a shell return code. In the CLI context, when the return code is non-zero, it will then call process.exit with that return code. Since the behaviour has changed, the version is bumped a major so that dependents don't pick this up automatically and encounter unexpected results.
1 parent ee3594f commit d5bc0ca

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

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",
3-
"version": "5.1.0",
3+
"version": "6.0.0",
44
"preferGlobal": "true",
55
"description": "launch iOS apps into the iOS Simulator from the command line (Xcode 7.0+)",
66
"main": "ios-sim.js",

src/cli.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ var nopt;
3737
function init() {
3838
try {
3939
nopt = require('nopt');
40-
command_lib.init();
40+
var code = command_lib.init();
41+
if (code !== 0) {
42+
process.exit(code);
43+
}
4144
} catch (e) {
4245
console.error(
4346
'Please run npm install from this directory:\n\t' +

src/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var path = require('path'),
3131
var command_lib = {
3232

3333
init: function() {
34-
lib.init();
34+
return lib.init();
3535
},
3636

3737
//jscs:disable disallowUnusedParams

src/lib.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,13 @@ var lib = {
274274
var output = simctl.check_prerequisites();
275275
if (output.code !== 0) {
276276
console.error(output.output);
277-
process.exit(2);
278277
}
279278

280279
if (!bplist) {
281280
bplist = require('bplist-parser');
282281
}
282+
283+
return output.code;
283284
},
284285

285286
//jscs:disable disallowUnusedParams

0 commit comments

Comments
 (0)