From b280378c3321c268c65c4f71e74b8f4f598b2790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 23 Aug 2021 20:35:28 +0200 Subject: [PATCH] Abort the watcher if stdin is closed to avoid zombie processes (#4997) * Abort the watcher if stdin is closed to avoid zombie processes * Apply suggestions from code review --- src/cli.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cli.js b/src/cli.js index 5d33eafa4..9a79ce3f9 100644 --- a/src/cli.js +++ b/src/cli.js @@ -784,6 +784,9 @@ async function build() { } if (shouldWatch) { + /* Abort the watcher if stdin is closed to avoid zombie processes */ + process.stdin.on('end', () => process.exit(0)) + process.stdin.resume() startWatcher() } else { buildOnce()