Skip to content

Commit

Permalink
fix(vscode): escape quotes in windows powershell (#2189)
Browse files Browse the repository at this point in the history
Signed-off-by: Max Kless <maxk@nrwl.io>
  • Loading branch information
MaxKless authored Jun 26, 2024
1 parent bb524d7 commit bb73bdf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libs/vscode/utils/src/lib/shell-execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { importNxPackagePath } from '@nx-console/shared/npm';
import type { PackageManagerCommands } from 'nx/src/utils/package-manager';
import { platform } from 'os';

import { ShellExecution } from 'vscode';
import { ShellExecution, workspace } from 'vscode';

export interface ShellConfig {
cwd: string;
Expand Down Expand Up @@ -34,6 +34,16 @@ export async function getShellExecutionForConfig(
command = `${pmc.exec} ${command}`;
}

const isPowershell =
platform() === 'win32' &&
workspace
.getConfiguration('terminal')
.get('integrated.defaultProfile.windows') === 'PowerShell';

if (isPowershell) {
command = command.replace(/"/g, '\\"');
}

return new ShellExecution(command, {
cwd: config.cwd,
});
Expand Down

0 comments on commit bb73bdf

Please sign in to comment.