From 6cf02aa27e53f6ba3a971860e9a3027079b8ce4d Mon Sep 17 00:00:00 2001 From: Bryce Gibson Date: Tue, 10 Nov 2015 08:44:42 +1100 Subject: [PATCH] Support exit code in shjs. --- bin/shjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/shjs b/bin/shjs index 10a3c24..aae3bc6 100644 --- a/bin/shjs +++ b/bin/shjs @@ -37,7 +37,9 @@ if (scriptName.match(/\.coffee$/)) { // CoffeeScript // if (which('coffee')) { - exec('coffee "' + scriptName + '" ' + args.join(' '), { async: true }); + exec('coffee "' + scriptName + '" ' + args.join(' '), function(code) { + process.exit(code); + }); } else { console.log('ShellJS: CoffeeScript interpreter not found'); console.log(); @@ -47,5 +49,7 @@ if (scriptName.match(/\.coffee$/)) { // // JavaScript // - exec('node "' + scriptName + '" ' + args.join(' '), { async: true }); + exec('node "' + scriptName + '" ' + args.join(' '), function(code) { + process.exit(code); + }); }