From 82e1b035e946b8f0924b7236aba91e10275a2edd Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 21 Jul 2020 15:01:30 +0800 Subject: [PATCH] support dotnet tool pwsh supoort:dotnet tool install -g powershell --- sudo.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'