Skip to content

ProcessExecutionTimeout leaves child processes after timeout #1305

Open
@ElijahReva

Description

@ElijahReva

Usage Information

Any

Description

Process execution timeout does not kill the whole process tree. My use case is the timeout for the "dotnet test". This process spawns the child process; when timeout happens, only the main process is killed.

Reproduction Steps

running dotnet test for net4.8 framework; Add Thread.Sleep in tests more than and Timeout in nuke build; After timeout observe orphan processes left in "procexp" tool

Expected Behavior

No orphan processes are left

Actual Behavior

Only the parent process is killed

Regression?

Nope.

Known Workarounds

netstandart2.0 examples

https://github.com/dotnet/msbuild/blob/vs15.9/src/Utilities/ProcessExtensions.cs
https://raw.githubusercontent.com/dotnet/cli/master/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/ProcessExtensions.cs

Latest Microsoft solution
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.kill?view=net-8.0#remarks

Could you help with a pull-request?

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions