Skip to content

Commit

Permalink
Merge pull request #215 from shazron/no_lib_exit
Browse files Browse the repository at this point in the history
Remove process.exit when simctl prerequisite does not pass
  • Loading branch information
shazron authored Jun 14, 2017
2 parents ee3594f + ebaea0b commit 4bbe6b3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ios-sim",
"version": "5.1.0",
"version": "6.0.0",
"preferGlobal": "true",
"description": "launch iOS apps into the iOS Simulator from the command line (Xcode 7.0+)",
"main": "ios-sim.js",
Expand Down
6 changes: 4 additions & 2 deletions spec/lib.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ describe('lib end-to-end', function() {
});
})

// it('', function(done) {
// });
it('init should not process.exit when called as a lib', function() {
var code = lib.init();
expect(!isNaN(code)).toBe(true);
});
});
5 changes: 4 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ var nopt;
function init() {
try {
nopt = require('nopt');
command_lib.init();
var code = command_lib.init();
if (code !== 0) {
process.exit(code);
}
} catch (e) {
console.error(
'Please run npm install from this directory:\n\t' +
Expand Down
2 changes: 1 addition & 1 deletion src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var path = require('path'),
var command_lib = {

init: function() {
lib.init();
return lib.init();
},

//jscs:disable disallowUnusedParams
Expand Down
3 changes: 2 additions & 1 deletion src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,13 @@ var lib = {
var output = simctl.check_prerequisites();
if (output.code !== 0) {
console.error(output.output);
process.exit(2);
}

if (!bplist) {
bplist = require('bplist-parser');
}

return output.code;
},

//jscs:disable disallowUnusedParams
Expand Down

0 comments on commit 4bbe6b3

Please sign in to comment.