path: root/perl
diff options
authorAbhijit Menon-Sen <>2008-08-04 11:38:27 (GMT)
committerJunio C Hamano <>2008-08-05 04:51:17 (GMT)
commit108c2aaf7984081daa6aed6d3947c7c0952216c2 (patch)
tree659dc0c3bbab67fac09d5263a93327c4de0f245d /perl
parentc72e0db1ff686e93478ee21a3e80a9ca73143753 (diff)
git-108c2aaf7984081daa6aed6d3947c7c0952216c2.tar.bz2 localise $? in command_close_bidi_pipe()
Git::DESTROY calls _close_cat_blob and _close_hash_and_insert_object, which in turn call command_close_bidi_pipe, which calls waitpid, which alters $?. If this happens during global destruction, it may alter the program's exit status unexpectedly. Making $? local to the function solves the problem. (The problem was discovered due to a failure of test #8 in Signed-off-by: Abhijit Menon-Sen <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'perl')
1 files changed, 1 insertions, 0 deletions
diff --git a/perl/ b/perl/
index 087d3d0..faaa19f 100644
--- a/perl/
+++ b/perl/
@@ -417,6 +417,7 @@ have more complicated structure.
sub command_close_bidi_pipe {
+ local $?;
my ($pid, $in, $out, $ctx) = @_;
foreach my $fh ($in, $out) {
unless (close $fh) {