diff --git a/sudo.ps1 b/sudo.ps1 index 485e9c4..b9145f6 100644 --- a/sudo.ps1 +++ b/sudo.ps1 @@ -2,7 +2,11 @@ Set-StrictMode -Off; if(!$args) { "usage: sudo "; exit 1 } -$powershellExe = Get-Process -Id $pid | Select-Object -ExpandProperty Path +$current = Get-Process -Id $pid +if($current.Name -eq 'dotnet'){ + $current = $current.Parent +} +$powershellExe = $current | Select-Object -ExpandProperty Path $commandPrefix = '' if ($host.Version.Major -gt 5) { $commandPrefix = '-Command'