Skip to content

Commit fe9f01c

Browse files
BlueBlue21Vexu
authored andcommitted
support powershell call operator
1 parent 56e39b9 commit fe9f01c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/zigMainCodeLens.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ function zigRun() {
4444
if (!zigPath) return;
4545
const filePath = vscode.window.activeTextEditor.document.uri.fsPath;
4646
const terminal = vscode.window.createTerminal("Run Zig Program");
47+
const callOperator = /(powershell.exe$|powershell$|pwsh.exe$|pwsh$)/.test(vscode.env.shell) ? "& " : "";
4748
terminal.show();
4849
const wsFolder = getWorkspaceFolder(filePath);
4950
if (wsFolder && isWorkspaceFile(filePath) && hasBuildFile(wsFolder.uri.fsPath)) {
50-
terminal.sendText(`${escapePath(zigPath)} build run`);
51+
terminal.sendText(`${callOperator}${escapePath(zigPath)} build run`);
5152
return;
5253
}
53-
terminal.sendText(`${escapePath(zigPath)} run ${escapePath(filePath)}`);
54+
terminal.sendText(`${callOperator}${escapePath(zigPath)} run ${escapePath(filePath)}`);
5455
}
5556

5657
function escapePath(rawPath: string): string {

0 commit comments

Comments
 (0)