简体   繁体   English

在C#中,我如何拥有一个覆盖标准process.WaitForExit()的process.WaitForExit(time)?

[英]In C# how do I have a process.WaitForExit(time) that overrides a standard process.WaitForExit()?

I want it to wait for the process to end before continuing, but if it doesn't end in x amount of time, continue anyway. 我希望它在继续之前等待过程结束,但是如果它没有在x时间内结束,请继续。 Thank you in advance for your help. 预先感谢您的帮助。

There already is aa method WaitForExit(int milliseconds) which you can use. 已经有一个可以使用的方法WaitForExit(int ms)

That method will wait the given amount of ms and return then, if the process did not exit before. 如果该过程之前未退出,则该方法将等待给定的毫秒数,然后返回。

If it returns true, the process had already exited, otherwise you might kill it on your own or continue your logic. 如果返回true,则表明该进程已经退出,否则您可以自行杀死它或继续执行逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM