语言

ProcessStartInfo.KillOnParentExit 属性

定义

获取或设置一个值,该值指示在父进程退出时是否应终止子进程。

public:
 property bool KillOnParentExit { bool get(); void set(bool value); };
[System.Runtime.Versioning.SupportedOSPlatform("android")]
[System.Runtime.Versioning.SupportedOSPlatform("linux")]
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public bool KillOnParentExit { get; set; }
[<System.Runtime.Versioning.SupportedOSPlatform("android")>]
[<System.Runtime.Versioning.SupportedOSPlatform("linux")>]
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
member this.KillOnParentExit : bool with get, set
Public Property KillOnParentExit As Boolean

属性值

true 在父进程退出时终止子进程;否则,为 false. 默认值为 false。

特性

注解

如果此属性设置为 true,则无论父进程正常退出还是崩溃,操作系统都会在父进程退出时自动终止子进程。

此属性不能与 UseShellExecute 设置为 true.

在Windows,该行为是使用具有JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE标志的作业对象实现的。

在 Linux 和 Android 上,该行为是使用 prctl(PR_SET_PDEATHSIG).

适用于