Skip to content

Commit

Permalink
Run *.cmd commands with shell: true
Browse files Browse the repository at this point in the history
This bypasses EINVAL [1] errors seen in CI on Windows.

[1] https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
  • Loading branch information
badeball committed Jun 6, 2024
1 parent 982ee5e commit e05488c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions features/support/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,22 @@ export default class CustomWorld implements ICustomWorld {
extraEnv: Record<string, string>;
expectedExitCode?: number;
}) {
const shell = cmd.endsWith(".cmd");

if (shell) {
// https://github.com/nodejs/node/issues/29532
args = args.map((arg) => `"${arg}"`);
}

const child = childProcess.spawn(cmd, args, {
stdio: ["ignore", "pipe", "pipe"],
cwd: this.tmpDir,
env: {
...process.env,
...extraEnv,
},
// https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
shell,
});

const combined = combine(child.stdout, child.stderr);
Expand Down

0 comments on commit e05488c

Please sign in to comment.