-
Notifications
You must be signed in to change notification settings - Fork 507
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
No .ps1 extension added when pwsh.exe is started via third-party tool #2253
Comments
I think both workarounds are reasonable. I lean towards adding an attribute which allows setting the shebang script extension: [extension: '.ps1']
stop-drivers:
#!gsudo pwsh Extending the heuristic seems error prone, since there are probably a bunch of ways that you might indirectly invoke a powershell script, but detecting |
I am not sure if this should be its own issue, but I'll post it here for now as I think it touches the same "logic" (maybe, sorry if not). When I want to execute stuff in a pwsh.exe shebang with arguments, I can't find a way of passing the arguments. I tried these shebangs:
All of them end up with an error message similar to this:
|
+1, also customizing shebang script extension has been brought up before - #1624 |
It is done! |
@casey awesome, you're so quick 😄 Is this also included in the fix (#2253 (comment)) or shall I create a new issue for it? |
You're most welcome! The issue you're running into is the way that the Shebang handling on Windows is super hacky, so I think the eventual fix will be #1479, which would let you do: [script("pwsh", "-NoLogo", "-NoProfileLoadTime", "-NoProfile", "-Command")]
foo: So you can dictate exactly how the arguments are split |
I am required to execute multiple commands running as administrator under Windows where the return value is ignored.
I use a third-party tool called gsudo.
justfile:
Output:
The same stuff "works" (it adds the
.ps1
as required) when I remove thegsudo
from the shebang line, but then my script-logic doesn't work anymore because it's not running as admin.Conclusion: just seems to check if pwsh.exe is the executable to be started in the shebang and only then add
.ps1
.Ideas for workarounds:
The text was updated successfully, but these errors were encountered: