Re: [HACKERS] pg_regress in C - Mailing list pgsql-patches

From Martijn van Oosterhout
Subject Re: [HACKERS] pg_regress in C
Date
Msg-id 20060719064537.GA31786@svana.org
Whole thread Raw
In response to Re: pg_regress in C  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] pg_regress in C
List pgsql-patches
On Tue, Jul 18, 2006 at 10:46:04PM -0400, Tom Lane wrote:
> ...  One reason I didn't try to do this is I'm a bit hesitant to
> write a signal handler that does anything as interesting as a system()
> call, which would seem to be necessary to duplicate what the shell
> script did.  Comments?

It might not actually be unsafe, given system() actually blocks on
waitpid() which is specifically listed as a "safe" function. I'm a bit
confused though, because system() generally sets the parent to ignore
SIGINT which running the child process. That means the postmaster is
being killed but pg_regress is not? If this is the case, then you won't
be able to catch SIGINT anyway.

Also, the kernel sending it to everyone on the same terminal is (AIUI)
only true if you're running under the same session ID. postgres only
daemonizes itself to be immune from frontend terminal interrupts (using
setsid) when silent_mode is on. I think it defaults to off, which is
probably why it works at all.

Anyway, the signal handling for Windows involves a seperate thead AIUI
which may make it easier. It might be interesting to see how bash does
it.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-patches by date:

Previous
From: Joe Conway
Date:
Subject: Re: [HACKERS] 8.2 features?
Next
From: Zdenek Kotala
Date:
Subject: Re: New regresion test for SET/RESET commnad