Skip to content

Commit 3a988d1

Browse files
committed
Read file instead of bash.
1 parent c67eabd commit 3a988d1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/BenchmarkDotNet/Disassemblers/ClrMdV2Disassembler.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Linq;
99
using System.Text.RegularExpressions;
1010
using BenchmarkDotNet.Portability;
11-
using BenchmarkDotNet.Helpers;
1211

1312
namespace BenchmarkDotNet.Disassemblers
1413
{
@@ -31,9 +30,17 @@ private static ulong GetMinValidAddress()
3130
};
3231
if (RuntimeInformation.IsLinux())
3332
{
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;
33+
try
34+
{
35+
if (File.Exists("/proc/sys/vm/mmap_min_addr"))
36+
{
37+
string? minAddrResult = File.ReadAllText("/proc/sys/vm/mmap_min_addr");
38+
ulong.TryParse(minAddrResult, out ulong minAddress);
39+
return minAddress;
40+
}
41+
}
42+
catch { }
43+
return 0;
3744
}
3845
throw new NotSupportedException($"{System.Runtime.InteropServices.RuntimeInformation.OSDescription} is not supported");
3946
}

0 commit comments

Comments
 (0)