Skip to content

Commit 581098a

Browse files
committed
use CancelRead when process does not exit on time, disable FileStream buffering
1 parent 1cb4a85 commit 581098a

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/BenchmarkDotNet/Engines/AnonymousPipesHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public AnonymousPipesHost(string writHandle, string readHandle)
2424
}
2525

2626
private Stream OpenAnonymousPipe(string fileHandle, FileAccess access)
27-
=> new FileStream(new SafeFileHandle(new IntPtr(int.Parse(fileHandle)), ownsHandle: true), access);
27+
=> new FileStream(new SafeFileHandle(new IntPtr(int.Parse(fileHandle)), ownsHandle: true), access, bufferSize: 1);
2828

2929
public void Dispose()
3030
{

src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private ExecuteResult Execute(BenchmarkCase benchmarkCase,
102102
{
103103
logger.WriteLineInfo($"// The benchmarking process did not quit within {ExecuteParameters.ProcessExitTimeout.TotalSeconds} seconds, it's going to get force killed now.");
104104

105-
processOutputReader.StopRead();
105+
processOutputReader.CancelRead();
106106
consoleExitHandler.KillProcessTree();
107107
}
108108
else

src/BenchmarkDotNet/Toolchains/Executor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private static ExecuteResult Execute(Process process, BenchmarkCase benchmarkCas
8383
{
8484
logger.WriteLineInfo("// The benchmarking process did not quit on time, it's going to get force killed now.");
8585

86-
processOutputReader.StopRead();
86+
processOutputReader.CancelRead();
8787
consoleExitHandler.KillProcessTree();
8888
}
8989
else

src/BenchmarkDotNet/Toolchains/MonoWasm/WasmExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private static ExecuteResult Execute(Process process, BenchmarkCase benchmarkCas
9393
{
9494
logger.WriteLineInfo("// The benchmarking process did not finish within 10 minutes, it's going to get force killed now.");
9595

96-
processOutputReader.StopRead();
96+
processOutputReader.CancelRead();
9797
consoleExitHandler.KillProcessTree();
9898
}
9999
else

0 commit comments

Comments
 (0)