Shutting down child processes started using System.Diagnostic.Process

  • Thread starter Lloyd Gomes via .NET 247
  • 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?
 
A

Alvin Bruney [ASP.NET MVP]

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top