diff --git a/bin/cordova b/bin/cordova index 1d634b1d9..e4cc6ef34 100755 --- a/bin/cordova +++ b/bin/cordova @@ -29,7 +29,11 @@ cli(process.argv).catch(err => { const errorOutput = typeof err === 'string' ? err : util.inspect(err); throw new CordovaError('Promise rejected with non-error: ' + errorOutput); } - process.exitCode = err.code || 1; + if (typeof err.code !== 'number') { + process.exitCode = 1; + } else { + process.exitCode = err.code; + } // We cannot emit an error event here, as that would cause another error console.error(err.message);