X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/38e27663cf656f0c9c443a2715f249afe39a8bfb..194eaad976697799f0e7dcccb581b52dc77feee3:/sdk/cli/bin/crunch-job diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job index 2415217a21..554a1431ee 100755 --- a/sdk/cli/bin/crunch-job +++ b/sdk/cli/bin/crunch-job @@ -1907,10 +1907,15 @@ if (readlink ("$destdir.commit") eq $commit && -d $destdir) { unlink "$destdir.commit"; mkdir $destdir; -open TARX, "|-", "tar", "-xC", $destdir; -{ - local $/ = undef; - print TARX ; + +if (!open(TARX, "|-", "tar", "-xC", $destdir)) { + die "Error launching 'tar -xC $destdir': $!"; +} +# If we send too much data to tar in one write (> 4-5 MiB), it stops, and we +# get SIGPIPE. We must feed it data incrementally. +my $tar_input; +while (read(DATA, $tar_input, 65536)) { + print TARX $tar_input; } if(!close(TARX)) { die "'tar -xC $destdir' exited $?: $!";