You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It doesn't not work that way. When powershell finds the curly braces it parses it content as a scriptblock,, and encodes it in base64 before passing it to gsudo.
# without braces, gsudo gets the raw command. Quotes fidelity issues may ocurr
PS C:\> gsudo --debug echo $env:windir
Debug: Command Line: --debug echo C:\WINDOWS
(...)
C:\WINDOWS
# with braces, gsudo gets an encoded command. Quotes fidelity is preserved
PS C:\> gsudo --debug { echo $env:windir }
Debug: Command Line: --debug -encodedCommand IABlAGMAaABvACAAJABlAG4AdgA6AHcAaQBuAGQAaQByACAA -inputFormat xml -outputFormat text
(...)
C:\WINDOWS
This mechanism was crafted so it's easy to call pwsh from within pwsh.
Thank you for your explanation. I wondered if it is possible to make powershell or terminal automatically convert the raw command into base64 when they execute gsudo by configuring them
Issue Description
Creating this ticket for a future self to investigate and fix: https://stackoverflow.com/a/74440425/97471
See #295.
Looks like this quoting is required on Pwsh >= 7.3.0: https://github.com/gerardog/gsudo/blob/v2.4.0/src/gsudo/Helpers/CommandToRunAdapter.cs#L159
Steps to Reproduce
Screenshots
Context:
The text was updated successfully, but these errors were encountered: