sub git {
my $fh = git_pipe (@_);
my $str = join ('', <$fh>);
+ unless (close $fh) {
+ die "'git @_' exited with nonzero value\n";
+ }
chomp($str);
return $str;
}
foreach my $line (@{$ioref}) {
print $fh $line, "\n";
}
- exit 0;
+ exit ! close $fh;
} else {
if ($dir ne '|-') {
open STDIN, '<', '/dev/null' or die "reopening stdin: $!"
chomp ();
push @tags, $_ if (m/^$prefix/);
}
+ unless (close $fh) {
+ die "'notmuch search --output=tags *' exited with nonzero value\n";
+ }
return @tags;
}
foreach my $pair (@{$status->{added}}) {
index_tags_for_msg ($git, $pair->{id}, 'A', $pair->{tag});
}
+ unless (close $git) {
+ die "'git update-index --index-info' exited with nonzero value\n";
+ }
+
}
my @tags = grep { s/^$TAGPREFIX//; } split (' ', $rest);
index_tags_for_msg ($git,$id, 'A', @tags);
}
-
- close $git;
+ unless (close $git) {
+ die "'git update-index --index-info' exited with nonzero value\n";
+ }
+ unless (close $fh) {
+ die "'notmuch dump -- $query' exited with nonzero value\n";
+ }
return $index;
}
} else {
push @deleted, $pair;
}
+ unless (close $fh) {
+ die "'notmuch search --output=files id:$id' exited with nonzero value\n";
+ }
}
qw/diff-index --cached/,
"--diff-filter=$filter", qw/--name-only HEAD/ );
- return unpack_diff_lines ($fh);
+ my @lines = unpack_diff_lines ($fh);
+ unless (close $fh) {
+ die "'git diff-index --cached --diff-filter=$filter --name-only HEAD' ",
+ "exited with nonzero value\n";
+ }
+ return @lines;
}
my $fh= git_pipe ( 'diff', "--diff-filter=$filter", '--name-only',
$ref1, $ref2);
- return unpack_diff_lines ($fh);
+ my @lines = unpack_diff_lines ($fh);
+ unless (close $fh) {
+ die "'git diff --diff-filter=$filter --name-only $ref1 $ref2' ",
+ "exited with nonzero value\n";
+ }
+ return @lines;
}