diff options
author | John Ankarström <john@ankarstrom.se> | 2021-05-26 22:39:12 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-05-26 22:39:56 +0200 |
commit | 393f6ef84459656d27c08ef8a0d571a0b209a309 (patch) | |
tree | 21697fba132099bd3ca35a316a37625e9e8d8068 | |
parent | c22ed54565b34c1600f30aaca26a4f5e116bcaf5 (diff) | |
download | mum-393f6ef84459656d27c08ef8a0d571a0b209a309.tar.gz |
mum: Fix pipe bug
Without handling SIGPIPE, mum may unexpectedly exit when the pager
exits.
-rwxr-xr-x | src/mum | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -123,9 +123,12 @@ h: $b = $MESSAGE if not $b; $a = $b if not $a; - open my $pager, '|-', $ENV{PAGER} || 'less' - or die "failed to open pager: $!"; - print $pager "$_\n" for get($a, $b); + open my $pager, '|-', $ENV{PAGER} || 'less' or do { + warn "failed to open pager: $!\n"; + next; + }; + local $SIG{PIPE} = sub {}; + print $pager "$_\n" for mbox($a, $b); close $pager; } |