Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zig: Run Zig command fails to launch in Windows Powershell #262

Open
xyx0826 opened this issue Dec 15, 2024 · 3 comments
Open

Zig: Run Zig command fails to launch in Windows Powershell #262

xyx0826 opened this issue Dec 15, 2024 · 3 comments
Labels

Comments

@xyx0826
Copy link

xyx0826 commented Dec 15, 2024

On Windows, the Zig: Run Zig command attempts to invoke a command line in Powershell. This command fails for the following:

PS C:\[redacted]> "c:\[pathto]\zig.exe" run "c:\[pathto]\main.zig"
At line:1 char:113
+ ... age\ziglang.vscode-zig\zig\windows-x86_64-0.13.0\zig.exe" run "c:\Use ...
+                                                               ~~~
Unexpected token 'run' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

A workaround I've found is to start the command line with an ampersand, &, known as the Powershell call operator.

PS C:\[redacted]> & "c:\[pathto]\zig.exe" run "c:\[pathto]\main.zig"
Hello, World!
@Vexu Vexu added the bug label Dec 16, 2024
@nurpax
Copy link

nurpax commented Dec 22, 2024

Works for me though. Here's what I see in the Terminal output when invoking Zig: Run Zig:

PS C:\Users\janne\dev\aoc2024\rest_of_days> C:\Users\janne\scoop\shims\zig.EXE build run

@xyx0826
Copy link
Author

xyx0826 commented Dec 22, 2024

Your path to zig doesn't have quotes. I just tried running my command without quotes and it worked without ampersand. Not sure what the logic is for adding quotes though.

@jlopezr
Copy link

jlopezr commented Jan 1, 2025

Same issue here... the problem is when the path contains spaces. In my case "c:\Users\j_lop\AppData\Roaming\Code - Insiders\User\globalStorage\ziglang.vscode-zig\zig\windows-x86_64-0.13.0\zig.exe".

One workaround is to set in vsc the default terminal profile to command prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants