remove restart on error

This commit is contained in:
Daniel Sommer 2022-05-03 15:21:42 +02:00
parent e0a8d2350e
commit 5ddaacea5c
2 changed files with 3 additions and 3 deletions

View file

@ -207,7 +207,6 @@ class StreamBuffer extends EventEmitter {
}
this.streams.output.on('error', (error) => {
logger.error('output stream encountered an error: ' + error);
restart();
});
this.streams.output.on('written', (bytes) => {
this.#writeBufferedChunk(bytes);

View file

@ -26,16 +26,17 @@ async function sleep(ms) {
}
function restart() {
logger.info('restarting...');
const args = process.argv;
const cmd = args[0];
args.shift();
const newProcess = spawn(cmd, args, { detached: true, stdio: 'ignore' });
newProcess.unref();
newProcess.on('error', (error) => {
logger.error('ERROR RESTARTING: '+ error);
logger.error('encountered an error restarting: ' + error);
});
newProcess.on('spawn', () => {
logger.warn('PROCESS RESTARTED WITH PID: ' + newProcess.pid);
logger.warn('spawned process with pid \'' + newProcess.pid + '\'');
process.exit(0);
});
}