[progress Communities] [progress Openedge Abl] Forum Post: Re: How To Trap The Signals Sent...

Status
Not open for further replies.
S

ske

Guest
Agreed. Except some nit-picks: > It does not change the rules for the shell's sub-processes. The command set by "trap" is not inherited, that is right. If "trap" is used to ignore the signal (trap "" ), though, then that setting IS in general (initially) inherited by the sub-process, and especially by sub-shells. It will still be ignored by the sub-shell. But in general the sub-process can change that, and choose to set their own trap anyway, like you say. > If sub-process is a new shell then it can use its own 'trap' command to change the default actions. A special case with the shell (at least all the ones on my system), is that if I ignore (only ignore) a signal in the parent shell, then a sub-shell does NOT allow me to set some other trap for that signal. But that is only a special rule applied by the shell, not other commands like Progress, so it is still of no use to you. For a demonstration, see the following: $ trap "" 1 $ echo $$ 27770 $ kill -1 27770 $ echo $$ 27770 # [Without the trap, it would have died. But now it was ignored.] $ sh $ echo $$ 27773 $ kill -1 27773 $ echo $$ 27773 # [The sub-shell didn't die either, as it would usually have done.] $ trap "echo SIG 1" 1 $ kill -1 27773 # [No "SIG 1" was printed. The trap didn't have any effect, because it was already ignored.]

Continue reading...
 
Status
Not open for further replies.
Top