sudo custom_function
markox92 opened this issue · 3 comments
Sudo for Windows version
1.0.0
Windows build number
10.0.26100.0
Other Software
No response
Steps to reproduce
I have write a custom function Get-Tools which will show some items like menu. All this time I used gsudo which is working just fine like gsudo Get-Tools and I run this function as Admin.
Now I just received native sudo support with latest Windows update and for some reason I can't run function in same way sudo Get-Tools return Command not found.
Expected Behavior
I expected to run function as admin.
Actual Behavior
Noting, got message that command not Command not found.
Thanks for filling this issue. I suspect this might be related to the #5 stuff that is not yet supported.
@lhecker wrote a good summary of what's happening in a different thread #110:
mkdir is a builtin command of PowerShell, not a standalone application like it would be on UNIX/Linux. You have to write sudo powershell -c '...' or sudo pwsh -c '...' to launch PowerShell and tell it to execute your command(s).
If you were to use cmd then sudo mkdir test would work. The builtin commands of cmd are quite a bit simpler and haven't changed in decades, so sudo supports them as a "shortcut" to help cmd users.
/needsinfo
Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!