
/* signal.q: catching signals with trap */

from system import getpid;

test		= do (trap 1) [SIGINT,SIGTSTP,SIGTERM,SIGHUP,SIGQUIT] ||
		  printf "I'm running as pid %d, try to kill me!\n" getpid ||
		  loop;

loop		= flush || catch sig (sleep 100);

sig (syserr K)	= printf "Hey, I got signal %d.\n" (-K) || loop;
