File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,31 @@ export class ProcessManagerImpl implements ProcessManager {
107107 reject ( { code : childProcess . exitCode , error : error } ) ;
108108 } ) ;
109109
110+ /*
111+ In Node child processes, 'exit' and' close' events mean different lifecycle points:
112+
113+ 'exit'
114+
115+ Emitted when the child process itself has ended.
116+ Gives you exit code and signal.
117+ May happen before all stdout and stderr data has been fully flushed/closed.
118+
119+ 'close'
120+
121+ Emitted when the process has ended and all stdio streams are closed.
122+ Also provides code and signal.
123+ This is usually the safer event if you need to be sure all output handling is finished.
124+ Typical ordering:
125+ exit first, then close.
126+
127+ Practical rule:
128+
129+ Use exit when you only care that the process terminated.
130+ Use close when you care about complete I/O completion (most
131+ command-runner cases).
132+
133+ We do care about output, therefore 'close' is used here.
134+ */
110135 childProcess . on ( 'close' , code => {
111136 if ( code === 0 ) {
112137 resolve ( { code : 0 } ) ;
You can’t perform that action at this time.
0 commit comments