
On 02 February 2005 14:39, Glynn Clements wrote:
Simon Marlow wrote:
I think this covers most of the useful situations. If you want to do the same thing in both parent and child, or handle in the parent and SIG_DFL in the child: use runProcess. If you want to ignore in the parent and SIG_DFL in the child: use System.Cmd.{system,rawSystem}. To handle in the parent and ignore in the child: unfortunately not directly supported.
As it stands, you can have whatever behaviour you want in the parent: set the desired handling before calling system/rawSystem/runProcess then set it back afterwards.
However, this will cease to be true for system/rawSystem if you change them so that the child restores the handlers to their state upon entry.
I don't understand... is there a typo somewhere above? Perhaps you meant "child" in the first paragraph? system/rawSystem now behave almost exactly like system() in C. The only difference is that you can't ignore SIGINT/SIGQUIT in the child, but I can fix that if necessary. Cheers, Simon

Simon Marlow wrote:
I think this covers most of the useful situations. If you want to do the same thing in both parent and child, or handle in the parent and SIG_DFL in the child: use runProcess. If you want to ignore in the parent and SIG_DFL in the child: use System.Cmd.{system,rawSystem}. To handle in the parent and ignore in the child: unfortunately not directly supported.
As it stands, you can have whatever behaviour you want in the parent: set the desired handling before calling system/rawSystem/runProcess then set it back afterwards.
However, this will cease to be true for system/rawSystem if you change them so that the child restores the handlers to their state upon entry.
I don't understand... is there a typo somewhere above? Perhaps you meant "child" in the first paragraph?
Sorry; I wasn't thinking straight. That part of my message is incorrect; changing the signal handling before calling system/rawSystem won't help, because they force both cases. If they were changed to behave like system(), the caller could determine the *child* behaviour, but that's prone to a race condition, so I doubt that it would be useful in practice.
system/rawSystem now behave almost exactly like system() in C. The only difference is that you can't ignore SIGINT/SIGQUIT in the child, but I can fix that if necessary.
I'm not sure how much it matters; system() isn't really of much use
for "real" programs anyhow.
--
Glynn Clements
participants (2)
-
Glynn Clements
-
Simon Marlow