Skip to content

Commit cd3767e

Browse files
committed
fix: replace & id -u subprocess with /proc/self/status read in BeforeDiscovery
1 parent af50f1d commit cd3767e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/NetTCPIP.Linux.Native.Tests/NetTCPIP.Linux.Native.Tests.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
BeforeDiscovery {
88
$script:isLinux = $IsLinux
9-
$script:isRoot = $IsLinux -and ((& id -u) -eq '0')
9+
$script:isRoot = $IsLinux -and (
10+
[System.IO.File]::ReadAllText('/proc/self/status') -match '(?m)^Uid:\s+(\d+)' -and
11+
$Matches[1] -eq '0')
1012
}
1113

1214
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)