Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 0d863dd

Browse files
committed
Switch env template to use path to shell vs env command
1 parent 2bbb427 commit 0d863dd

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

client/src/util/env.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const RUBY_ENVIRONMENT_VARIABLES = [
1919
];
2020

2121
function mkShim(shell: string, shimPath: string): boolean {
22-
const template = `#!/usr/bin/env ${shell} -i\nexport`;
22+
const template = `#!${shell} -i\nexport`;
2323
let result = false;
2424

2525
try {
@@ -33,11 +33,11 @@ function mkShim(shell: string, shimPath: string): boolean {
3333
return result;
3434
}
3535

36-
function getShim(shell): string {
37-
const shellName = path.basename(shell);
38-
const shimPath = path.join(SHIM_DIR, `env.${shell}`);
36+
function getShim(): string {
37+
const shellName: string = path.basename(defaultShell);
38+
const shimPath = path.join(SHIM_DIR, `env.${shellName}`);
3939
if (!fs.existsSync(shimPath)) {
40-
mkShim(shellName, shimPath);
40+
mkShim(defaultShell, shimPath);
4141
}
4242

4343
return shimPath;
@@ -58,9 +58,7 @@ export interface IEnvironment {
5858
}
5959

6060
export function loadEnv(cwd: string): RubyEnvironment {
61-
const shellName: string = path.basename(defaultShell);
62-
const env: IEnvironment = {};
63-
const shim: string = getShim(shellName);
61+
const shim: string = getShim();
6462
const { stdout, stderr } = execa.sync(shim, [], {
6563
cwd,
6664
});

0 commit comments

Comments
 (0)