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

时间:2015-06-15 14:56:07

标签: c# 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. Thank you in advance for your help.

1 个答案:

答案 0 :(得分:0)

There already is a a method WaitForExit(int milliseconds) which you can use.

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.