Skip to content

Commit

Permalink
Fix spawn EINVAL on Windows when using Node > 20.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r committed May 16, 2024
1 parent 3ef76c2 commit 6712aea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ class SpawnError extends Error {
*/
function spawnProcess(command, args, options) {
return new BbPromise((resolve, reject) => {
const child = childProcess.spawn(command, args, options);
const child = childProcess.spawn(command, args, {
...options,
// nodejs 20 on windows doesn't allow `.cmd` command to run without `shell: true`
// https://github.com/serverless-heaven/serverless-webpack/issues/1791
shell: /^win/.test(process.platform)
});
let stdout = '';
let stderr = '';
// Configure stream encodings
Expand Down

0 comments on commit 6712aea

Please sign in to comment.