Skip to content

Commit cb5297e

Browse files
authored
fix: use double quotes for create-playwright args on cmd.exe (#792)
1 parent b74a0b9 commit cb5297e

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/installer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export async function installPlaywright(vscode: vscodeTypes.VSCode) {
5252

5353
terminal.show();
5454

55+
const shell = path.basename(vscode.env.shell || '').toLowerCase();
56+
const q = shell === 'cmd.exe' || shell === 'cmd' ? '"' : '\'';
57+
5558
const args: string[] = [];
5659
if (result.includes(chromiumItem))
5760
args.push('--browser=chromium');
@@ -68,11 +71,7 @@ export async function installPlaywright(vscode: vscodeTypes.VSCode) {
6871
if (result.includes(installDepsItem))
6972
args.push('--install-deps');
7073

71-
terminal.sendText(`npm init playwright@latest --yes "--" . ${quote('--quiet')} ${args.map(quote).join(' ')}`, true);
72-
}
73-
74-
function quote(s: string): string {
75-
return `'${s}'`;
74+
terminal.sendText(`npm init playwright@latest --yes "--" . ${q}--quiet${q} ${args.map(a => `${q}${a}${q}`).join(' ')}`, true);
7675
}
7776

7877
export async function installBrowsers(vscode: vscodeTypes.VSCode, model: TestModel) {

0 commit comments

Comments
 (0)