From 5b6ab2165e7104dc8a99c44f07fcd7d2efac3d6e Mon Sep 17 00:00:00 2001 From: Tan Zhen Yong Date: Tue, 31 Aug 2021 21:33:45 +0800 Subject: [PATCH] fix(command-dev): ensure no orphaned child process on Windows `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)