Ugh. system('cvs update -rtagname') breaks this when the tagname doesn't exist.
It dies with a signal for some reason, rather than just giving a simple non-zero exit status. If the command fails like that, I just want to continue running the perl script. perdoc -q control-c doesn't say any particular bit is used to flag control-c, but the cvs command set bit 1, while a control-c during a cp -r command set bit 2. If I just test bit 2 rather than 7..0, would that still trap all the control-c's but let all the commands that failed on their own to keep running? thanks, Greg Attempting: cd /work/sodium/london/tar/fire4230/autolink/inkprintif/rtl/bist; cvs update -l -f -rfire4230_inkprintif_050118_1 cvs [update aborted]: no such tag fire4230_inkprintif_050118_1 ERROR ON RETVAL=256: cd /work/sodium/london/tar/fire4230/autolink/inkprintif/rtl/bist; cvs update -l -f -rfire4230_inkprintif_050118_1 at /tools/pm/bin/create_rtl_snapshot_of_rtl.pl line 44. Process exited with status 1 at /tools/pm/bin/create_rtl_snapshot_of_rtl.pl line 47 Aaron Sherman wrote: > > On Tue, 2005-01-25 at 11:34, Uri Guttman wrote: > > >>>>> "GL" == Greg London <[EMAIL PROTECTED]> writes: > > > GL> After the system call, how do I test for a control-c > > GL> as the cause for the command ending? > > > > look at $@ and check for why the process died. you can extract a signal > > number from it (shift 8 bits and mask IIRC, rtfm for details. i think > > perlvar covers it). > > This is incorrect. $@ is for eval, $? is for system. > > > GL> Oh, and I can't simply say > > > > GL> system('cp -r longtree dest')==0 or die $@; > > > > GL> because some system commands will fail because the > > GL> directory doesn't exist or something, and in those > > GL> cases, I want the script to keep going. > > > > just check for SIGINT and handle that. > > You're correct, but that's not clear to the uninitiated. Here's the > explanation: > > $? contains the exit status of the program. On POSIX-compliant systems > this is a number which is: > > ($exit << 8) | $signal > > Where $exit is the parameter that the program passed to exit(2), and > $signal is the signal that interrupted the process, if any. > > You can check to see if the process was killed by: > > if ($? & 0xff) { > die "Process killed by signal ".($? & 0xff); > } elsif ($? >> 8) { > die "Process exited with status ".($? >> 8); > } else { > # Worked fine > } > > Make sense? > > This is also a faq, so you can type: > > perldoc -q control-c > > to see what the lord of the FAQ says ;-) > > -- > â~? 781-324-3772 > â?? [EMAIL PROTECTED] > â~· http://www.ajs.com/~ajs > > > _______________________________________________ > Boston-pm mailing list > Boston-pm@mail.pm.org > http://mail.pm.org/mailman/listinfo/boston-pm -- Greg London Zoran Corporation 781-638-7541 _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm