Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Answer: How do I trap $SIG{INT} ( sigint aka Ctrl^c )?

by Anonymous Monk
on Feb 26, 2003 at 16:00 UTC ( #238807=categorized answer: print w/replies, xml ) Need Help??

Q&A > programs and processes > How do I trap $SIG{INT} ( sigint aka Ctrl^c )? - Answer contributed by Anonymous Monk

Instead of killing yourself, as suggested by crazyinsomniac, you could also try just exiting. This avoids the shell's response of 'aborted' when the program is killed. I.e.:

sub myhand
{
  print "\n caught $SIG{INT}",@_,"\n";
  exit(0);
}

-Josh O-

  • Comment on Answer: How do I trap $SIG{INT} ( sigint aka Ctrl^c )?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[LanX]: hope you find sleep
[shmem]: LanX: which one?
[LanX]: the last
Discipulus yes a very bad day
[shmem]: grandola, vila morena
[shmem]: LanX: ah, that one. You'll get the bug reports also :P
[Discipulus]: upvote me! i'll make pm great again! ;=)
[shmem]: Discipulus reminds me of an irish saying: "I would guess a tomorrow can wait 'til this day is done" :-)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-04-29 22:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (534 votes). Check out past polls.