From 166714373af427b9bc504fcc1655c213828cc3d0 Mon Sep 17 00:00:00 2001 From: Piotr Kaminski Date: Fri, 11 Sep 2020 14:34:52 -0700 Subject: [PATCH] Ensure that child build processes started when running on Windows exit properly. (#1022) 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;