diff --git a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
index 17366ae9811736..3904ae89bd0b15 100644
--- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
+++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
@@ -201,6 +201,13 @@ public ProcessModuleCollection(System.Diagnostics.ProcessModule[] processModules
public void CopyTo(System.Diagnostics.ProcessModule[] array, int index) { }
public int IndexOf(System.Diagnostics.ProcessModule module) { throw null; }
}
+ public sealed partial class ProcessExitStatus
+ {
+ public ProcessExitStatus(int exitCode, bool canceled, System.Runtime.InteropServices.PosixSignal? signal = null) { throw null; }
+ public bool Canceled { get { throw null; } }
+ public int ExitCode { get { throw null; } }
+ public System.Runtime.InteropServices.PosixSignal? Signal { get { throw null; } }
+ }
public enum ProcessPriorityClass
{
Normal = 32,
diff --git a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
index 986ee67013d3d7..083fc33a6e2bce 100644
--- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
+++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
@@ -20,6 +20,7 @@
+
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessExitStatus.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessExitStatus.cs
new file mode 100644
index 00000000000000..eefda01fea93f9
--- /dev/null
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessExitStatus.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics
+{
+ ///
+ /// Represents the exit status of a process.
+ ///
+ public sealed class ProcessExitStatus
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The exit code of the process.
+ /// A value indicating whether the process has been terminated due to timeout or cancellation.
+ /// On Unix, the POSIX signal that terminated the process, or null if the process exited normally.
+ public ProcessExitStatus(int exitCode, bool canceled, PosixSignal? signal = null)
+ {
+ ExitCode = exitCode;
+ Canceled = canceled;
+ Signal = signal;
+ }
+
+ ///
+ /// Gets the exit code of the process.
+ ///
+ ///
+ ///
+ /// If the process was terminated by a signal on Unix, this is 128 + the signal number.
+ /// Use to get the actual signal.
+ ///
+ ///
+ public int ExitCode { get; }
+
+ ///
+ /// Gets the POSIX signal that terminated the process on Unix, or if the process was not terminated by a signal.
+ ///
+ ///
+ ///
+ /// 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 .
+ ///
+ ///
+ public PosixSignal? Signal { get; }
+
+ ///
+ /// Gets a value indicating whether the process has been terminated due to timeout or cancellation.
+ ///
+ public bool Canceled { get; }
+ }
+}
diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessExitStatusTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessExitStatusTests.cs
new file mode 100644
index 00000000000000..f72630cd479a11
--- /dev/null
+++ b/src/libraries/System.Diagnostics.Process/tests/ProcessExitStatusTests.cs
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.InteropServices;
+using Xunit;
+
+namespace System.Diagnostics.Tests
+{
+ public class ProcessExitStatusTests
+ {
+ [Fact]
+ public void Constructor_WithExitCodeOnly_SetsPropertiesCorrectly()
+ {
+ ProcessExitStatus status = new ProcessExitStatus(0, false);
+
+ Assert.Equal(0, status.ExitCode);
+ Assert.False(status.Canceled);
+ Assert.Null(status.Signal);
+ }
+
+ [Fact]
+ public void Constructor_WithNonZeroExitCode_SetsPropertiesCorrectly()
+ {
+ ProcessExitStatus status = new ProcessExitStatus(42, false);
+
+ Assert.Equal(42, status.ExitCode);
+ Assert.False(status.Canceled);
+ Assert.Null(status.Signal);
+ }
+
+ [Fact]
+ public void Constructor_WithCanceled_SetsPropertiesCorrectly()
+ {
+ ProcessExitStatus status = new ProcessExitStatus(1, true);
+
+ Assert.Equal(1, status.ExitCode);
+ Assert.True(status.Canceled);
+ Assert.Null(status.Signal);
+ }
+
+ [Fact]
+ public void Constructor_WithSignal_SetsPropertiesCorrectly()
+ {
+ ProcessExitStatus status = new ProcessExitStatus(137, false, PosixSignal.SIGTERM);
+
+ Assert.Equal(137, status.ExitCode);
+ Assert.False(status.Canceled);
+ Assert.Equal(PosixSignal.SIGTERM, status.Signal);
+ }
+
+ [Fact]
+ public void Constructor_WithAllParameters_SetsPropertiesCorrectly()
+ {
+ ProcessExitStatus status = new ProcessExitStatus(130, true, PosixSignal.SIGINT);
+
+ Assert.Equal(130, status.ExitCode);
+ Assert.True(status.Canceled);
+ Assert.Equal(PosixSignal.SIGINT, status.Signal);
+ }
+ }
+}
diff --git a/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj b/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
index 93cb8d34b091e1..290d268462e0a7 100644
--- a/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
+++ b/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
@@ -25,6 +25,7 @@
+