From 344ba318424336cb076497eb7423f7ccf3de3b8f Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Mon, 1 Apr 2024 04:00:10 +0300 Subject: [PATCH] Simplify the spawn handler and close the socket --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 2d8b6ac..08621b7 100644 --- a/index.js +++ b/index.js @@ -14,9 +14,9 @@ const zmq = require('zeromq'); spawn( 'minode', ['--request-queue', 'tcp://127.0.0.1:5566'], - {timeout: 100000, killSignal: 'SIGTERM'} - ).stderr.on('data', (data) => { - console.log(`${data}`); + {timeout: 100000, killSignal: 'SIGTERM', detached: true, stdio: 'inherit'} + ).on('exit', (c, s) => { + sock.close(); }); const sender = Address.fromRandom(),