diff --git a/packages/ansible-language-server/src/utils/misc.ts b/packages/ansible-language-server/src/utils/misc.ts index 1bcef4bb5..30001446e 100644 --- a/packages/ansible-language-server/src/utils/misc.ts +++ b/packages/ansible-language-server/src/utils/misc.ts @@ -58,7 +58,8 @@ export function withInterpreter( }); if (activationScript) { - command = `bash -c 'source ${activationScript} && ${executable} ${args}'`; + // keep it sh as this can be either bash or zsh + command = `sh -c 'source ${activationScript} && ${executable} ${args}'`; return { command: command, env: process.env }; } diff --git a/packages/ansible-language-server/test/utils/withInterpreter.test.ts b/packages/ansible-language-server/test/utils/withInterpreter.test.ts index 42c312fce..255673c6d 100644 --- a/packages/ansible-language-server/test/utils/withInterpreter.test.ts +++ b/packages/ansible-language-server/test/utils/withInterpreter.test.ts @@ -19,7 +19,7 @@ describe("withInterpreter", () => { interpreterPath: "", activationScript: "/path/to/venv/bin/activate", expectedCommand: - "bash -c 'source /path/to/venv/bin/activate && ansible-lint playbook.yml'", + "sh -c 'source /path/to/venv/bin/activate && ansible-lint playbook.yml'", expectedEnv: {}, }, { diff --git a/src/features/ansibleTox/runner.ts b/src/features/ansibleTox/runner.ts index 946dadaa9..7dc8ee38e 100644 --- a/src/features/ansibleTox/runner.ts +++ b/src/features/ansibleTox/runner.ts @@ -28,7 +28,8 @@ export async function getToxEnvs( )) as string; if (activationScript) { - command = `bash -c 'source ${activationScript} && ${command}'`; + // keep it sh as this can be either bash or zsh + command = `sh -c 'source ${activationScript} && ${command}'`; } if (interpreterPath && interpreterPath !== "") { const virtualEnv = path.resolve(interpreterPath, "../.."); diff --git a/src/features/utils/commandRunner.ts b/src/features/utils/commandRunner.ts index 9c75b8881..2881c3eca 100644 --- a/src/features/utils/commandRunner.ts +++ b/src/features/utils/commandRunner.ts @@ -28,7 +28,8 @@ export function withInterpreter( const activationScript = settings.activationScript; if (activationScript) { - command = `bash -c 'source ${activationScript} && ${runExecutable} ${cmdArgs}'`; + // keep it sh as this can be either bash or zsh + command = `sh -c 'source ${activationScript} && ${runExecutable} ${cmdArgs}'`; return { command: command, env: process.env }; }