Kill subprocess if local end of connection closes

This commit is contained in:
Tony Garnock-Jones 2018-11-29 16:40:34 +00:00
parent f92923567e
commit 7c70fa74fe
1 changed files with 6 additions and 1 deletions

View File

@ -57,7 +57,12 @@ spawn named 'driver/Subprocess' {
sp.off('error', rejecter);
send S.ConnectionAccepted(id);
const s = new Duplex(sp.stdout, sp.stdin);
establishingFacet.stop(() => { react S.duplexStreamBehaviour(id, s); });
establishingFacet.stop(() => {
react {
S.duplexStreamBehaviour(id, s);
on stop try { sp.kill('SIGHUP'); } catch (e) {}
}
});
}));
}