Skip to content

Commit

Permalink
find node via shell in cwd
Browse files Browse the repository at this point in the history
This change sets the "cwd" option to the first available workspace folder when spawning a shell in "findNodeViaShell"
  • Loading branch information
slushie authored Jan 15, 2024
1 parent bb89463 commit 8e46ace
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,11 @@ async function findNodeViaShell(vscode: vscodeTypes.VSCode): Promise<string | un
return new Promise<string | undefined>(resolve => {
const startToken = '___START_PW_SHELL__';
const endToken = '___END_PW_SHELL__';
const cwd = vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0] : undefined;
const childProcess = spawn(`${vscode.env.shell} -i -c 'echo ${startToken} && which node && echo ${endToken}'`, {
stdio: 'pipe',

Check failure on line 172 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on ubuntu-latest, Node 16

No overload matches this call.

Check failure on line 172 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on windows-latest, Node 16

No overload matches this call.

Check failure on line 172 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on macos-latest, Node 16

No overload matches this call.

Check failure on line 172 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on ubuntu-latest, Node 18

No overload matches this call.
shell: true
shell: true,
cwd,
});
let output = '';
childProcess.stdout.on('data', data => output += data.toString());

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on ubuntu-latest, Node 16

Property 'stdout' does not exist on type 'never'.

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on ubuntu-latest, Node 16

Parameter 'data' implicitly has an 'any' type.

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on windows-latest, Node 16

Property 'stdout' does not exist on type 'never'.

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on windows-latest, Node 16

Parameter 'data' implicitly has an 'any' type.

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on macos-latest, Node 16

Property 'stdout' does not exist on type 'never'.

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on macos-latest, Node 16

Parameter 'data' implicitly has an 'any' type.

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on ubuntu-latest, Node 18

Property 'stdout' does not exist on type 'never'.

Check failure on line 177 in src/utils.ts

View workflow job for this annotation

GitHub Actions / Run tests on ubuntu-latest, Node 18

Parameter 'data' implicitly has an 'any' type.
Expand Down

0 comments on commit 8e46ace

Please sign in to comment.