File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ function main() {
180180 // Invoke the command in a sub-process:
181181 proc = spawn ( 'node' , subargs , opts ) ;
182182 proc . on ( 'error' , onError ) ;
183+ proc . on ( 'close' , onClose ) ;
183184
184185 /**
185186 * Callback invoked upon encountering an error while running a command.
@@ -190,6 +191,21 @@ function main() {
190191 function onError ( error ) {
191192 cli . error ( error ) ;
192193 }
194+
195+ /**
196+ * Callback invoked upon command exit.
197+ *
198+ * @private
199+ * @param {integer } code - exit code
200+ * @param {(string|null) } signal - exit signal
201+ */
202+ function onClose ( code , signal ) {
203+ if ( signal ) {
204+ process . kill ( process . pid , signal ) ;
205+ return ;
206+ }
207+ process . exit ( code || 0 ) ;
208+ }
193209}
194210
195211main ( ) ;
You can’t perform that action at this time.
0 commit comments