in reply to pipe to less crash

Are you catching SIGPIPE? See perlvar and/or give us a small (10 line) program that exhibits the problem. Also see How do I post a question effectively?

Replies are listed 'Best First'.
Re^2: pipe to less crash
by Anonymous Monk on Jul 01, 2011 at 19:00 UTC

    Okay, thanks. I now added a trap for SIGPIPE and I got an error "can't close: status = -1 at ...". So what do I from there? Also, here is code. Thanks again.

    $SIG{PIPE} = 'IGNORE'; open LESS, '|less' or die "unable to start pager"; print LESS $string or die "cant write: $!"; close LESS or die "can't close: status = $?"; system("clear");
      There was an error: You tried to write to a broken pipe.
      if (!print LESS $string) { die "cant write: $!" if !$!{EPIPE}; } close LESS;

      So, if you don't want your program to die, why do you use close or die? There are valid situations when close returns a false value, as you've found out, for example when the receiving end of the pipe has gone away.

        The way my program works is that the user sees a list of files and they can choose one and it will open with less, but then once they exit less, I want them to be brought to the program.