On Wed, 31 Oct 2012 08:39:53 -0500 David Ashley <w.david.ash...@gmail.com> wrote:
> Rick will need to comment on this. I am not an expert in the > interpreter code base. > Ok, I had a deeper look at this. Here is a small test script which could be used to verify my coding: /* REXX */ signal on halt file=.stream~new("sig.lst") pull file~close() exit(0); halt: msg = "Signal on halt reached." file~lineout(date() time() msg) /* Append a line to the file */ file~close() The script writes a message if signal on halt hits. Take the current 4.1.2 rexx interpreter and run it. There are three test cases. 1. rexx sigtest.rexx Press Ctrl-C. This triggers SIGINT, and is already implemented in rexx. A record will be written to file sig.lst 2. rexx sigest.rexx Get the pid of the process and do kill <pid>. This triggers signal SIGTERM. Not implemented in rexx. No record written. 3. xterm -e rexx sigtest.rexx a. Now click the x button to close the window. This triggers signal SIGHUP. Not implemented in rexx, no record written. b. Check for the pids of the two processes, i.e. xterm and rexx. Kill the one or the other by using ordinary kill. In neither case a record will be written. I think that additionally SIGTERM and SIGHUP should be trapped by signal on halt. Then in these cases rexx has a chance to do cleanup work before exiting the script. Here is what must be changed so that all above examples result in a record written, i.e. signal on halt will honor SIGTERM and SIGHUP (additionally to SIGINT). Index: interpreter/platform/unix/SystemInterpreter.cpp =================================================================== --- interpreter/platform/unix/SystemInterpreter.cpp (revision 8547) +++ interpreter/platform/unix/SystemInterpreter.cpp (working copy) @@ -101,7 +101,9 @@ #endif // if the signal is a ctrl-C, we perform a halt operation - if (sig == SIGINT) + if (sig == SIGINT || + sig == SIGTERM || + sig == SIGHUP) { Interpreter::haltAllActivities(); return; @@ -132,9 +134,13 @@ /* that we now get a coredump instead of a hang up */ sigaction(SIGINT, NULL, &old_action); + sigaction(SIGTERM, NULL, &old_action); + sigaction(SIGHUP, NULL, &old_action); if (old_action.sa_handler == NULL) /* not set by ext. exit handler*/ { - sigaction(SIGINT, &new_action, NULL); /* exitClear on SIGTERM signal */ + sigaction(SIGINT, &new_action, NULL); /* exitClear on SIGINT signal */ + sigaction(SIGTERM, &new_action, NULL); /* exitClear on SIGTERM signal */ + sigaction(SIGHUP, &new_action, NULL); /* exitClear on SIGHUP signal */ } } What do you thing? Please check the code. Thanks a lot. -- Manfred ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel