Skip to content

Commit ab8de31

Browse files
authored
chore: skip setting process priority on non-windows os (dotnet#2924)
1 parent 9f877c4 commit ab8de31

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/BenchmarkDotNet/Extensions/ProcessExtensions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public static class ProcessExtensions
2727

2828
public static void EnsureHighPriority(this Process process, ILogger logger)
2929
{
30+
// Process.set_PriorityClass requires root on Unix
31+
if (!OsDetector.IsWindows())
32+
return;
33+
3034
try
3135
{
3236
process.PriorityClass = ProcessPriorityClass.High;
@@ -63,6 +67,10 @@ public static bool TrySetPriority(
6367
if (logger == null)
6468
throw new ArgumentNullException(nameof(logger));
6569

70+
// Process.set_PriorityClass requires root on Unix
71+
if (!OsDetector.IsWindows())
72+
return false;
73+
6674
try
6775
{
6876
process.PriorityClass = priority;

0 commit comments

Comments
 (0)