[Mono-list] Sending POSIX signals to external processes

Haakon Nilsen haakonn@gmail.com
Wed, 21 Jul 2004 21:36:46 +0200


Hi,

I'm writing a C# program with Mono.  I start an external program with
System.Diagnostics.Process.  In some situations (triggered by the user), I
want to kill the process in as friendly a manner as possible.  Using
Process.Kill is the obvious (and only) choice, but this is far too brutal; 
the process is not given a chance to clean up after itself, so it leaves a
lock file.  I know though experiments with kill(1) that this program, if
sent a SIGTERM, will take care of cleaing up after itself.  Is there any
way at all to send such a signal?  I suppose I could start yet another
Process that runs 'kill -s SIGTERM ...', but this seems a little dirty.

Thanks for any help,
Haakon Nilsen.