From 22ffa6bb744401a99ba7331387748a4dfd94e939 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Martin Date: Thu, 3 Mar 2022 13:37:50 +0100 Subject: [PATCH 1/3] fix: fix stdio and tons of windows issues This PR adds back stdio for output priting and the `shell: true` to spawn method so it can properly run in Windows. This was broken in https://github.com/serverless/serverless-python-requirements/commit/937fa564bf12fcb043678a0b48064bc60cbd2ea2 --- lib/pip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pip.js b/lib/pip.js index 9e7c592e..dd501bd0 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -400,7 +400,7 @@ async function installRequirements(targetFolder, pluginInstance) { for (const [cmd, ...args] of mainCmds) { try { - await spawn(cmd, args); + await spawn(cmd, args, spawnArgs); } catch (e) { if ( e.stderrBuffer && From 6b3ae49893d4c66d837e3c06014dc3453346f5f2 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Thu, 3 Mar 2022 16:47:16 +0100 Subject: [PATCH 2/3] feat: always output stdout and stderr --- lib/pip.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pip.js b/lib/pip.js index dd501bd0..6fa2f463 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -379,10 +379,10 @@ async function installRequirements(targetFolder, pluginInstance) { break; } - let spawnArgs = { shell: true }; - if (process.env.SLS_DEBUG) { - spawnArgs.stdio = 'inherit'; - } + const spawnArgs = { + shell: true, + stdio: 'inherit' + }; let mainCmds = []; if (dockerCmd.length) { dockerCmd.push(...mergeCommands(pipCmds)); From 345fb7e2501cfb9003a235526060b6b4b824e7b3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Tue, 8 Mar 2022 14:38:46 +0100 Subject: [PATCH 3/3] style: match prettier requirements --- lib/pip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pip.js b/lib/pip.js index 95e703ea..81f39457 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -385,7 +385,7 @@ async function installRequirements(targetFolder, pluginInstance) { const spawnArgs = { shell: true, - stdio: 'inherit' + stdio: 'inherit', }; let mainCmds = []; if (dockerCmd.length) {