Process.Kill之后是否需要使用Process.WaitForExit?
Process.Kill之后是否需要使用Process.WaitForExit?
如果调用进程在调用 Process.Kill 后立即退出怎么办?
这会导致 Process.Kill 失败吗?
编辑:我需要在退出应用程序时终止进程。此时我不打算处理kill失败的情况,因此我没有必要等待进程退出。因此,如果不需要调用 WaitForExit,我可以跳过它。
Is it necessary to use Process.WaitForExit after Process.Kill?
What if the calling process exits right after it calls Process.Kill?
Would this cause Process.Kill to fail?
Edit: I need to kill a process on exiting my application. At this point I do not intend to handle the situations when kill fails so it is not necessary for me to wait for the process to exit. So if calling WaitForExit is not necessary I could just skip it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 MSDN 上的文档(重点是我的)
如果您不需要等待,或者如果您不需要确定进程是否确实存在,那么我想您不需要调用
WaitForExit
或检查HasExited.
According to the documentation on MSDN (emphasis mine)
If you don't need to wait, of if you don't need to determine if the process actually exists, then I suppose you don't need to call
WaitForExit
or checkHasExited
.