[YLUG] borken pipe

Steve Kemp steve at steve.org.uk
Wed Jun 18 13:25:21 BST 2008


On Wed Jun 18, 2008 at 13:17:40 +0100, Patrick Dupre wrote:

> How can I detect a broken pipe ?

  Via testing for SIGPIPE ?

  Something like this:

  #!/usr/bin/perl -w

  use strict;
  use warnings;

  $SIG{'PIPE'} = 'PIPE'
  sub PIPE {
    print "Detected broken pipe.\n";
    exit;
  }

  #
  # your perl code here ..
  # .. and still here.
  #


  Search google for "perl signals" + pipe / sigpipe and you should find
 more specific advice.

Steve
-- 
Debian GNU/Linux System Administration
http://www.debian-administration.org/




More information about the York mailing list