diff --git a/bin/cli b/bin/cli index 94eec1fb40b5..3c72df733900 100644 --- a/bin/cli +++ b/bin/cli @@ -180,6 +180,7 @@ function main() { // Invoke the command in a sub-process: proc = spawn( 'node', subargs, opts ); proc.on( 'error', onError ); + proc.on( 'close', onClose ); /** * Callback invoked upon encountering an error while running a command. @@ -190,6 +191,16 @@ function main() { function onError( error ) { cli.error( error ); } + + /** + * Callback invoked upon child process close. + * + * @private + * @param {integer} code - exit code + */ + function onClose( code ) { + process.exit( code || 0 ); + } } -main(); +main(); \ No newline at end of file