From ca0ccdc7cc366d34838e05a2afe571f605d90567 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Tue, 28 Sep 2021 00:20:11 -0700 Subject: [PATCH] dummy-switch: close stdin --- plugins/dummy-switch/package-lock.json | 4 ++-- plugins/dummy-switch/package.json | 2 +- plugins/dummy-switch/src/main.ts | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/dummy-switch/package-lock.json b/plugins/dummy-switch/package-lock.json index ec25e30ec..5f88ad78d 100644 --- a/plugins/dummy-switch/package-lock.json +++ b/plugins/dummy-switch/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/dummy-motion-sensor", - "version": "0.0.2", + "version": "0.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/dummy-motion-sensor", - "version": "0.0.2", + "version": "0.0.4", "dependencies": { "@types/node": "^16.6.1", "axios": "^0.19.0" diff --git a/plugins/dummy-switch/package.json b/plugins/dummy-switch/package.json index 3a621dab0..90dd22388 100644 --- a/plugins/dummy-switch/package.json +++ b/plugins/dummy-switch/package.json @@ -34,5 +34,5 @@ "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.0.2" + "version": "0.0.4" } diff --git a/plugins/dummy-switch/src/main.ts b/plugins/dummy-switch/src/main.ts index 29bd170ac..c92728273 100644 --- a/plugins/dummy-switch/src/main.ts +++ b/plugins/dummy-switch/src/main.ts @@ -58,8 +58,10 @@ class DummySwitch extends ScryptedDeviceBase implements OnOff, Scriptable { }, }); cp.stdin.write(source.script); + cp.stdin.end(); cp.stdout.on('data', data => this.console.log(data.toString())); cp.stderr.on('data', data => this.console.log(data.toString())); + cp.on('exit', () => this.console.log('shell exited')); } }