Skip to content

Commit 8d125d0

Browse files
committed
Read file instead of bash.
1 parent c67eabd commit 8d125d0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/BenchmarkDotNet/Disassemblers/ClrMdV2Disassembler.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,17 @@ private static ulong GetMinValidAddress()
3131
};
3232
if (RuntimeInformation.IsLinux())
3333
{
34-
string? minAddrResult = ProcessHelper.RunAndReadOutput("/bin/bash", "sudo cat /proc/sys/vm/mmap_min_addr");
35-
ulong.TryParse(minAddrResult, out ulong minAddress);
36-
return minAddress;
34+
try
35+
{
36+
if (File.Exists("/proc/sys/vm/mmap_min_addr"))
37+
{
38+
string? minAddrResult = File.ReadAllText("/proc/sys/vm/mmap_min_addr");
39+
ulong.TryParse(minAddrResult, out ulong minAddress);
40+
return minAddress;
41+
}
42+
}
43+
catch { }
44+
return 0;
3745
}
3846
throw new NotSupportedException($"{System.Runtime.InteropServices.RuntimeInformation.OSDescription} is not supported");
3947
}

0 commit comments

Comments
 (0)