Skip to content

Commit a7410df

Browse files
committed
fix: do not default to /bin/bash
1 parent fadbbd0 commit a7410df

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

lib/sub-process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function execute(
1313
options?,
1414
): Promise<CmdOutput> {
1515
const spawnOptions: any = {
16-
shell: process.platform !== "win32" ? "/bin/bash" : true,
16+
shell: true,
1717
env: { ...process.env },
1818
};
1919
if (options && options.cwd) {

test/lib/sub-process.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { quoteAll } from "shescape";
12
import { execute } from "../../lib/sub-process";
23

34
describe("sub-process", () => {
@@ -31,4 +32,24 @@ describe("sub-process", () => {
3132
expect(stdout).toContain("NO_PROXY=snyk.com");
3233
expect(process.env.NO_PROXY).toStrictEqual("example.com");
3334
});
35+
36+
describe("quoteAll", () => {
37+
const shellOptions = [false, true, "/bin/sh"];
38+
if (process.platform !== "win32") {
39+
shellOptions.push(
40+
"/bin/bash",
41+
"/bin/zsh",
42+
"/bin/dash",
43+
"/bin/ksh",
44+
"/bin/csh",
45+
"/bin/busybox",
46+
);
47+
}
48+
49+
for (const shell of shellOptions) {
50+
it(`does not throw when shell is ${shell}`, () => {
51+
expect(() => quoteAll(["test"], { shell })).not.toThrow();
52+
});
53+
}
54+
});
3455
});

0 commit comments

Comments
 (0)