feat(cli/daemon/processmonitor): Add flexible target resolution and search command; improve restart/backoff and error handling
This commit is contained in:
@@ -156,6 +156,11 @@ export class ProcessManager extends EventEmitter {
|
||||
this.updateProcessInfo(config.id, { pid: undefined });
|
||||
});
|
||||
|
||||
// Set up failure handler to mark process as errored
|
||||
monitor.on('failed', () => {
|
||||
this.updateProcessInfo(config.id, { status: 'errored', pid: undefined });
|
||||
});
|
||||
|
||||
await monitor.start();
|
||||
|
||||
// Wait a moment for the process to spawn and get its PID
|
||||
@@ -327,6 +332,11 @@ export class ProcessManager extends EventEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
// Mark errored on failure events
|
||||
newMonitor.on('failed', () => {
|
||||
this.updateProcessInfo(id, { status: 'errored', pid: undefined });
|
||||
});
|
||||
|
||||
this.logger.info(`Successfully restarted process with id '${id}'`);
|
||||
} catch (error: Error | unknown) {
|
||||
const processError = new ProcessError(
|
||||
|
Reference in New Issue
Block a user