mirror of
https://github.com/koush/scrypted.git
synced 2026-05-05 22:00:27 +01:00
strictNullChecks: fix plugin runtime workers
- Add non-null assertions for worker and stdio access - Add non-null assertions for kill() undefined assignments
This commit is contained in:
@@ -52,8 +52,8 @@ export class CustomRuntimeWorker extends ChildProcessWorker {
|
||||
}
|
||||
|
||||
setupRpcPeer(peer: RpcPeer): void {
|
||||
const peerin = this.worker.stdio[3] as Writable;
|
||||
const peerout = this.worker.stdio[4] as Readable;
|
||||
const peerin = this.worker!.stdio[3]! as Writable;
|
||||
const peerout = this.worker!.stdio[4]! as Readable;
|
||||
|
||||
const serializer = this.serializer = createRpcDuplexSerializer(peerin);
|
||||
serializer.setupRpcPeer(peer);
|
||||
|
||||
@@ -77,7 +77,7 @@ export class NodeForkWorker extends ChildProcessWorker {
|
||||
}
|
||||
|
||||
setupRpcPeer(peer: RpcPeer): void {
|
||||
this.worker.on('message', (message, sendHandle) => {
|
||||
this.worker!.on('message', (message, sendHandle) => {
|
||||
if ((message as any).type && sendHandle) {
|
||||
peer.handleMessage(message as any, {
|
||||
sendHandle,
|
||||
|
||||
@@ -104,8 +104,8 @@ export class NodeThreadWorker extends EventEmitter implements RuntimeWorker {
|
||||
return;
|
||||
this.worker.terminate();
|
||||
this.port.close();
|
||||
this.port = undefined;
|
||||
this.worker = undefined;
|
||||
this.port = undefined!;
|
||||
this.worker = undefined!;
|
||||
}
|
||||
|
||||
send(message: RpcMessage, reject?: (e: Error) => void, serializationContext?: any): void {
|
||||
|
||||
Reference in New Issue
Block a user