SomeStackoverflowUser
SomeStackoverflowUser

Reputation: 23

How to Dispose a process, where you don't want to wait for exit

I have a process p in my application, which will be closed by the user at some point while my application is still running. But I want my application to run on while p is running. How do I then dispose p after p were closed by the user?

Upvotes: 2

Views: 245

Answers (1)

Tobias Brohl
Tobias Brohl

Reputation: 519

Use p.Exited += (emitter, args) => ((Process) emitter).Dispose(); before starting p

Upvotes: 2

Related Questions