From ef396b2dfee4f199c254af1ff73600998ad54ff0 Mon Sep 17 00:00:00 2001 From: Tan Zhen Yong Date: Wed, 1 Sep 2021 00:45:29 +0800 Subject: [PATCH] fix(command-dev): ensure no orphaned child process on Windows (#3278) `execa` defaults to `windowsHide: true`, which prevents child processes from terminating child processes on exit [1]. Let's set `windowsHide: false` to terminate child processes properly on exit. [1]: https://github.com/sindresorhus/execa/issues/433 --- src/commands/dev/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commands/dev/index.js b/src/commands/dev/index.js index ed6033c35e8..a98d56c267b 100644 --- a/src/commands/dev/index.js +++ b/src/commands/dev/index.js @@ -61,7 +61,13 @@ const startFrameworkServer = async function ({ settings, exit }) { log(`${NETLIFYDEVLOG} Starting Netlify Dev with ${settings.framework || 'custom config'}`) // we use reject=false to avoid rejecting synchronously when the command doesn't exist - const frameworkProcess = execa.command(settings.command, { preferLocal: true, reject: false, env: settings.env }) + const frameworkProcess = execa.command(settings.command, { + preferLocal: true, + reject: false, + env: settings.env, + // windowsHide needs to be false for child process to terminate properly on Windows + windowsHide: false, + }) frameworkProcess.stdout.pipe(stripAnsiCc.stream()).pipe(process.stdout) frameworkProcess.stderr.pipe(stripAnsiCc.stream()).pipe(process.stderr) process.stdin.pipe(frameworkProcess.stdin)