Skip to content

Commit

Permalink
tune
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Jul 3, 2024
1 parent e95c3f5 commit f99e1e8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/subprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class SubProcess extends EventEmitter {
// when the proc exits, we might still have a buffer of lines we were
// waiting on more chunks to complete. Go ahead and emit those, then
// re-emit the exit so a listener can handle the possibly-unexpected exit
this.proc.once('exit', (code, signal) => {
this.proc.on('exit', (code, signal) => {
this.emit('exit', code, signal);

// in addition to the bare exit event, also emit one of three other
Expand All @@ -211,11 +211,14 @@ class SubProcess extends EventEmitter {
}
this.emit(event, code, signal);

// finally clean up the proc and make sure to reset our exit
// expectations
// make sure to reset our exit expectations
this.expectingExit = false;
});

this.proc.once('close', () => {
// finally clean up the proc and
this.proc?.removeAllListeners();
this.proc = null;
this.expectingExit = false;
});

// if the user hasn't given us a startDetector, instead just resolve
Expand Down

0 comments on commit f99e1e8

Please sign in to comment.