[fpc-pascal] sending signal to child process

Tom Carly tom.carly at commsquare.com
Tue Mar 31 12:48:03 CEST 2009


I found that the problem is coming from the fact that I use
process.Options := ProcessB.Options + [poUsePipes];

If I switch that off, process B does execute the signal handling code. Is this a bug or am I missing something?



-----Original Message-----
From: fpc-pascal-bounces at lists.freepascal.org [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Henry Vermaak
Sent: maandag 30 maart 2009 16:37
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] sending signal to child process

2009/3/30 Tom Carly <tom.carly at commsquare.com>:
> Hi,
> I have a process A that starts another process B (with TProcess.Create).
> I introduced signal handling for SIGHUP, SIGTERM and SIGINT in process A and
> process B.
> The signal handling of process A triggers a call to
> "fpkill(processA.processid, SIGTERM)" (or "processA.Terminate(0)").

do you mean processB.processid here?

> This code is executed when killing process A.
> The problem is that the signal handling code of process B is not executed
> when killing process A (although process B does get killed).
> If I launch process B separately and kill it, then the signal handling code
> of process B is executed. It seems that the signal that is sent from process
> A to process B is not the same as when you kill it via the command line.

are the permissions the same for the two processes?  are you sending
sigterm from the commandline, too?

i've done something similar before, but using a different signal.
that shouldn't matter, since sigterm can be blocked (unlike sigkill
and sigstop).

fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org

More information about the fpc-pascal mailing list