X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=devel%2Fnmbug%2Fnmbug;fp=devel%2Fnmbug%2Fnmbug;h=4a79722613c85fd869244a7bccf7f04604806b8f;hp=b18ded7b7c1e48cf7b54a1e6901cb92c7cbf1961;hb=4697e86a523fbbe43bf7ef38169f526adcbd710c;hpb=f47eeac0b0186c3559eb559c4f0bee0e1fac1961 diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug index b18ded7b..4a797226 100755 --- a/devel/nmbug/nmbug +++ b/devel/nmbug/nmbug @@ -63,13 +63,20 @@ sub git_pipe { spawn ($envref, defined $ioref ? $ioref : (), defined $dir ? $dir : (), @_); } -sub git { +sub git_with_status { my $fh = git_pipe (@_); my $str = join ('', <$fh>); - unless (close $fh) { + close $fh; + my $status = $?; + chomp($str); + return ($str, $status); +} + +sub git { + my ($str, $status) = git_with_status (@_); + if ($status) { die "'git @_' exited with nonzero value\n"; } - chomp($str); return $str; }