Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit c541132

Browse files
auto restart on unhandled errors.
1 parent 45247ac commit c541132

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

dist/process-helper.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ProcessHelper extends messenger_1.Messenger {
3838
this.start();
3939
};
4040
this.childProcess.on('exit', this.autoRestartListener);
41+
this.childProcess.on('error', this.autoRestartListener);
4142
}
4243
this.connect(this.childProcess);
4344
}
@@ -48,6 +49,7 @@ class ProcessHelper extends messenger_1.Messenger {
4849
if (this.childProcess.pid) {
4950
this.disconnect();
5051
this.childProcess.off('exit', this.autoRestartListener);
52+
this.childProcess.off('error', this.autoRestartListener);
5153
this.autoRestartListener = undefined;
5254
this.childProcess.kill('SIGTERM');
5355
this.childProcess = undefined;

src/process-helper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class ProcessHelper extends Messenger {
5959
};
6060

6161
this.childProcess.on('exit', this.autoRestartListener);
62+
this.childProcess.on('error', this.autoRestartListener);
6263
}
6364

6465
this.connect(this.childProcess);
@@ -72,6 +73,7 @@ export class ProcessHelper extends Messenger {
7273
this.disconnect();
7374

7475
this.childProcess.off('exit', this.autoRestartListener!);
76+
this.childProcess.off('error', this.autoRestartListener!);
7577
this.autoRestartListener = undefined;
7678

7779
this.childProcess.kill('SIGTERM');

0 commit comments

Comments
 (0)