From ec9ecb2fb7f243cc8a3749830d90771c28768aba Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Sun, 7 Jun 2026 13:17:43 +0530 Subject: [PATCH] Propagate child process exit codes in CLI --- bin/cli | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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