mirror of
https://github.com/koush/scrypted.git
synced 2026-02-18 12:32:37 +00:00
server: watch for worker errors
This commit is contained in:
@@ -55,6 +55,13 @@ export class PythonRuntimeWorker extends ChildProcessWorker {
|
||||
}
|
||||
|
||||
send(message: RpcMessage, reject?: (e: Error) => void): void {
|
||||
(this.worker.stdio[3] as Writable).write(JSON.stringify(message) + '\n', e => e && reject?.(e));
|
||||
try {
|
||||
if (!this.worker)
|
||||
throw new Error('worked has been killed');
|
||||
(this.worker.stdio[3] as Writable).write(JSON.stringify(message) + '\n', e => e && reject?.(e));
|
||||
}
|
||||
catch (e) {
|
||||
reject?.(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user