bitwes / gut-extension

VSCode extension to run GUT from the editor.
MIT License
29 stars 6 forks source link

Powershell doesn't interpret '-' arguments correctly : Unexpected token '-s' #33

Closed WebF0x closed 7 months ago

WebF0x commented 7 months ago

Gut-extension: 2.2.0 Godot-tools: 2.0.0 Windows 10

Note: Careful when you'll test, I think there's something wrong with godot-tools' release. It says the version is 2.0.0 but I get this error, as if you last PR adding getGodotPath is not included:

2024-02-28 20:38:10.171 [error] Error: command 'godotTools.getGodotPath' not found
    at k.n (vscode-file://vscode-app/c:/Users/Bob/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1587:12345)
    at k.executeCommand (vscode-file://vscode-app/c:/Users/Bob/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1587:12274)

Anyhow, I installed it from their master branch: https://nightly.link/godotengine/godot-vscode-plugin/workflows/ci/master/godot-tools.zip

Now I get this error:

PS C:\Users\Bob\Desktop\GodotProjects\TestProjectVscode> "c:/Program Files (x86)/Steam/steamapps/common/Godot Engine/godot.windows.opt.tools.64.exe" -s res://addons/gut/gut_cmdln.gd  -d 
At line:1 char:93
+ ... amapps/common/Godot Engine/godot.windows.opt.tools.64.exe" -s res://a ...      
+                                                                ~~
Unexpected token '-s' in expression or statement.
At line:1 char:96
+ ... /godot.windows.opt.tools.64.exe" -s res://addons/gut/gut_cmdln.gd  -d
+                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'res://addons/gut/gut_cmdln.gd' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

I don't know by what cursed Powershell dark magic, but if I add an & at the start it runs Gut correctly:

PS C:\Users\Bob\Desktop\GodotProjects\TestProjectVscode> & "c:/Program Files (x86)/Steam/steamapps/common/Godot Engine/godot.windows.opt.tools.64.exe" -s res://addons/gut/gut_cmdln.gd  -d 
PS C:\Users\Bob\Desktop\GodotProjects\TestProjectVscode> Godot Engine v4.2.1.stable.official.b09f793f5 - https://godotengine.org
Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2070

 ---  Gut  ---
[INFO]:  using [C:/Users/Bob/AppData/Roaming/Godot/app_userdata/TestProjectVscode] for temporary output.
Godot version:  4.2.1
GUT version:  9.1.1

image

bitwes commented 7 months ago

The extension usually adds in the & for you. For some reason it's not detecting that the shell is powershell and not putting in the &. I got a release that should be coming out in a day or so that changes shell detection and offers up more settings to make working around stuff like this easier.

I'll comment when I have it all merged.

bitwes commented 7 months ago

The changes have been merged. Detecting powershell should be more reliable now. Also, if it is still getting it wrong you can set the shell in the extension settings to "powershell" and that should fix it. If it doesn't you can set the shell to "cmd" and see if that works, or any other valid shell name/path.

WebF0x commented 7 months ago

Amazing! It works well!