Repository: dotnet/runtime
File: src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessExitStatus.cs (C#)

Code before:

namespace System.Diagnostics
{
    /// <summary>
    /// Represents the exit status of a process.
    /// </summary>
    public sealed class ProcessExitStatus
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessExitStatus"/> class.
        /// </summary>
        /// <param name="exitCode">The exit code of the process.</param>
        /// <param name="canceled">A value indicating whether the process has been terminated due to timeout or cancellation.</param>
        /// <param name="signal">The POSIX signal that terminated the process, or null if the process exited normally.</param>
        public ProcessExitStatus(int exitCode, bool canceled, PosixSignal? signal = null)
        {
            ExitCode = exitCode;
            Canceled = canceled;
            Signal = signal;
        }

        /// <summary>
        /// Gets the exit code of the process.
        /// </summary>
        /// <remarks>
        /// <para>On Windows, this is the value passed to ExitProcess or returned from main().</para>
        /// <para>On Unix, if the process exited normally, this is the value passed to exit() or returned from main().</para>
        /// <para>
        /// If the process was terminated by a signal on Unix, this is 128 + the signal number.
        /// Use <see cref="Signal"/> to get the actual signal.
        /// </para>
        /// </remarks>
        public int ExitCode { get; }

        /// <summary>
        /// Gets the POSIX signal that terminated the process on Unix, or <see langword="null" /> if the process was not terminated by a signal.
        /// </summary>
        /// <remarks>
        /// <para>
        /// On Unix, a process can be terminated by a signal (e.g., SIGKILL, SIGTERM). When this happens,
        /// the kernel reports "terminated by signal X" rather than an exit code. This property captures
        /// that signal. When the process exits normally on Unix, or on Windows where signals do not exist,
        /// this property is <see langword="null" />.
        /// </para>
        /// </remarks>
        public PosixSignal? Signal { get; }

        /// <summary>
        /// Gets a value indicating whether the process has been terminated due to timeout or cancellation.
        /// </summary>
        public bool Canceled { get; }

Review comment (suggestion):
`main()` and `exit()` are C runtime functions. This is .NET documentation. We should be describing this using .NET equivalents.

Windows has `exit()` in C runtime too. Also, there are number of other ways an exit code can be set. I do not think we need to explain it here. Maybe just say "For example, this is the value returned from the C# program `Main()` function." instead of the Windows/Unix examples.

Code after:

namespace System.Diagnostics
{
    /// <summary>
    /// Represents the exit status of a process.
    /// </summary>
    public sealed class ProcessExitStatus
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessExitStatus"/> class.
        /// </summary>
        /// <param name="exitCode">The exit code of the process.</param>
        /// <param name="canceled">A value indicating whether the process has been terminated due to timeout or cancellation.</param>
        /// <param name="signal">On Unix, the POSIX signal that terminated the process, or null if the process exited normally.</param>
        public ProcessExitStatus(int exitCode, bool canceled, PosixSignal? signal = null)
        {
            ExitCode = exitCode;
            Canceled = canceled;
            Signal = signal;
        }

        /// <summary>
        /// Gets the exit code of the process.
        /// </summary>
        /// <remarks>
        /// <para>
        /// If the process was terminated by a signal on Unix, this is 128 + the signal number.
        /// Use <see cref="Signal"/> to get the actual signal.
        /// </para>
        /// </remarks>
        public int ExitCode { get; }

        /// <summary>
        /// Gets the POSIX signal that terminated the process on Unix, or <see langword="null" /> if the process was not terminated by a signal.
        /// </summary>
        /// <remarks>
        /// <para>
        /// On Unix, a process can be terminated by a signal (e.g., SIGKILL, SIGTERM). When this happens,
        /// the kernel reports "terminated by signal X" rather than an exit code. This property captures
        /// that signal. When the process exits normally on Unix, or on Windows where signals do not exist,
        /// this property is <see langword="null" />.
        /// </para>
        /// </remarks>
        public PosixSignal? Signal { get; }

        /// <summary>
        /// Gets a value indicating whether the process has been terminated due to timeout or cancellation.
        /// </summary>
        public bool Canceled { get; }
    }
}