Skip to content

Commit dffb676

Browse files
authored
Update index.js
1 parent 0661b93 commit dffb676

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,19 @@ function start(file) {
4646
case 'uptime':
4747
p.send(process.uptime());
4848
break;
49+
default:
50+
console.warn('[⚠️ UNRECOGNIZED MESSAGE]', data);
4951
}
5052
});
5153

5254
p.on('exit', (_, code) => {
5355
isRunning = false;
54-
console.error('[❗]Exited with code:', code);
55-
if (code !== 0) return start(file);
56+
console.error('[❗] Exited with code:', code);
57+
if (code !== 0) {
58+
console.log('[🔄 Restarting worker due to non-zero exit code...');
59+
return start(file);
60+
}
61+
5662
watchFile(args[0], () => {
5763
unwatchFile(args[0]);
5864
start(file);

0 commit comments

Comments
 (0)