Skip to content

[API Proposal]: Rename ProcessExitStatus.Canceled to Killed. #128938

@tmds

Description

@tmds

Background and motivation

ProcessExitStatus is added in .NET 11 to represent the exit status of a process. It has three properties: ExitCode, Signal, and Canceled.

The Canceled property indicates whether the process was killed due to timeout or cancellation by either the SafeProcessHandle.WaitForExitOrKillOnTimeout or SafeProcessHandle.WaitForExitOrKillOnCancellationAsync APIs.

This proposes to use Killed in the status to indicate that the process was terminated by .NET. This decouples it from the above APIs.

API Proposal

namespace System.Diagnostics;

public sealed class ProcessExitStatus
{
-   public ProcessExitStatus(int exitCode, bool canceled, PosixSignal? signal = null);
+   public ProcessExitStatus(int exitCode, bool killed, PosixSignal? signal = null);

    public int ExitCode { get; }
    public PosixSignal? Signal { get; }
-   public bool Canceled { get; }
+   public bool Killed { get; }
}

Alternatives

Instead of renaming Canceled, it could be removed entirely and a user can use Signal instead. On Unix, this is set already to PosixSignal.SIGKILL. On Windows, we could do the same when the process is killed by .NET.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-System.Diagnostics.ProcessuntriagedNew issue has not been triaged by the area owner

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions