Shutting down child processes started using System.Diagnostic.Process

  • Thread starter Thread starter Lloyd Gomes via .NET 247
  • Start date Start date
L

Lloyd Gomes via .NET 247

I have searched extensively and not found anything on how to dothis.

The prolem is as follows. I have a console application thatlaunches some command line utilities using theSystem.Diagnostic.Process class. Basically I want to just killany of these child processes if the parent/controlling app dies.I have tried everything suggested including things likeimplementing the IDisposable interface but nothing seems to workbasically i need to terminate all child processes as soon as theparent dies. Any suggestions?
 
You should maintain a reference to the invokded process and store it
somewhere - static variable maybe (yuck, that is so wrong) - but then you
can use a catch handler to access the reference and kill the process when
the application domain unloads. That is, assuming you have put code in the
unload event for the application domain. makes sense?

--
Regards,
Alvin Bruney

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
------------------------------------------------------------

I have searched extensively and not found anything on how to do this.

The prolem is as follows. I have a console application that launches some
command line utilities using the System.Diagnostic.Process class. Basically
I want to just kill any of these child processes if the parent/controlling
app dies. I have tried everything suggested including things like
implementing the IDisposable interface but nothing seems to work basically i
need to terminate all child processes as soon as the parent dies. Any
suggestions?
 
Back
Top