From 4ba39f6041c27fb90b024e485b56d09fe23daebc Mon Sep 17 00:00:00 2001 From: Piotr Kaminski Date: Wed, 9 Sep 2020 18:38:49 -0700 Subject: [PATCH] Ensure that child build processes started when running on Windows exit properly. plugin-run-script and plugin-build script use execa.command with the shell: true option set to execute the user's command. On Windows, this causes the child process to remain running after Snowpack exits: https://github.com/sindresorhus/execa/issues/433. The fix is to override the default windowsHide option -- as Snowpack always runs from a console we don't actually need execa to hide any extra console windows for us. --- plugins/plugin-build-script/plugin.js | 1 + plugins/plugin-run-script/plugin.js | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/plugin-build-script/plugin.js b/plugins/plugin-build-script/plugin.js index 5451220ebf..043a2cacd5 100644 --- a/plugins/plugin-build-script/plugin.js +++ b/plugins/plugin-build-script/plugin.js @@ -21,6 +21,7 @@ function buildScriptPlugin(_, {input, output, cmd}) { env: npmRunPath.env(), extendEnv: true, shell: true, + windowsHide: false, input: contents, cwd, }); diff --git a/plugins/plugin-run-script/plugin.js b/plugins/plugin-run-script/plugin.js index 7695f250e2..e4786aa53c 100644 --- a/plugins/plugin-run-script/plugin.js +++ b/plugins/plugin-run-script/plugin.js @@ -13,6 +13,7 @@ function runScriptPlugin(_, {cmd, watch, output}) { env: npmRunPath.env(), extendEnv: true, shell: true, + windowsHide: false, cwd, }); const {stdout, stderr} = workerPromise;