mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-26 16:07:54 +00:00
Fixed bug #38439: "open files" with --files --pipe blocks after a while.
This commit is contained in:
parent
d5fa05b425
commit
93dd376c69
15
src/parallel
15
src/parallel
|
@ -1094,7 +1094,7 @@ sub read_args_from_command_line {
|
||||||
# Group of arguments on the command line.
|
# Group of arguments on the command line.
|
||||||
# Put them into a file.
|
# Put them into a file.
|
||||||
# Create argfile
|
# Create argfile
|
||||||
my ($outfh,$name) = ::tempfile(SUFFIX => ".arg", UNLINK => 1);
|
my ($outfh,$name) = ::tempfile(SUFFIX => ".arg");
|
||||||
unlink($name);
|
unlink($name);
|
||||||
# Put args into argfile
|
# Put args into argfile
|
||||||
print $outfh map { $_,$/ } @group;
|
print $outfh map { $_,$/ } @group;
|
||||||
|
@ -2429,7 +2429,7 @@ sub swap_activity {
|
||||||
# As the command can take long to run if run remote
|
# As the command can take long to run if run remote
|
||||||
# save it to a tmp file before moving it to the correct file
|
# save it to a tmp file before moving it to the correct file
|
||||||
my $file = $self->{'swap_activity_file'};
|
my $file = $self->{'swap_activity_file'};
|
||||||
my ($dummy_fh, $tmpfile) = ::tempfile(SUFFIX => ".swp", UNLINK => 1);
|
my ($dummy_fh, $tmpfile) = ::tempfile(SUFFIX => ".swp");
|
||||||
qx{ ($swap_activity > $tmpfile; mv $tmpfile $file) & };
|
qx{ ($swap_activity > $tmpfile; mv $tmpfile $file) & };
|
||||||
}
|
}
|
||||||
return $self->{'swap_activity'};
|
return $self->{'swap_activity'};
|
||||||
|
@ -2512,7 +2512,7 @@ sub loadavg {
|
||||||
# As the command can take long to run if run remote
|
# As the command can take long to run if run remote
|
||||||
# save it to a tmp file before moving it to the correct file
|
# save it to a tmp file before moving it to the correct file
|
||||||
my $file = $self->{'loadavg_file'};
|
my $file = $self->{'loadavg_file'};
|
||||||
my ($dummy_fh, $tmpfile) = ::tempfile(SUFFIX => ".loa", UNLINK => 1);
|
my ($dummy_fh, $tmpfile) = ::tempfile(SUFFIX => ".loa");
|
||||||
qx{ ($uptime > $tmpfile && mv $tmpfile $file) & };
|
qx{ ($uptime > $tmpfile && mv $tmpfile $file) & };
|
||||||
}
|
}
|
||||||
return $self->{'loadavg'};
|
return $self->{'loadavg'};
|
||||||
|
@ -3927,11 +3927,10 @@ sub start {
|
||||||
my ($outfh,$errfh,$name);
|
my ($outfh,$errfh,$name);
|
||||||
# To group we create temporary files for STDOUT and STDERR
|
# To group we create temporary files for STDOUT and STDERR
|
||||||
# To avoid the cleanup unlink the files immediately (but keep them open)
|
# To avoid the cleanup unlink the files immediately (but keep them open)
|
||||||
my $unlink = $opt::files ? 0 : 1;
|
($outfh, $name) = ::tempfile(SUFFIX => ".par");
|
||||||
($outfh, $name) = ::tempfile(SUFFIX => ".par", UNLINK => $unlink);
|
|
||||||
$job->set_stdoutfilename($name);
|
$job->set_stdoutfilename($name);
|
||||||
$unlink and unlink $name;
|
$opt::files or unlink $name;
|
||||||
($errfh, $name) = ::tempfile(SUFFIX => ".par", UNLINK => $unlink);
|
($errfh, $name) = ::tempfile(SUFFIX => ".par");
|
||||||
unlink $name;
|
unlink $name;
|
||||||
|
|
||||||
open OUT, '>&', $outfh or ::die_bug("Can't redirect STDOUT: $!");
|
open OUT, '>&', $outfh or ::die_bug("Can't redirect STDOUT: $!");
|
||||||
|
@ -3967,7 +3966,7 @@ sub start {
|
||||||
# Bug:
|
# Bug:
|
||||||
# If the command does not read the first char, the temp file
|
# If the command does not read the first char, the temp file
|
||||||
# is not deleted.
|
# is not deleted.
|
||||||
my ($dummy_fh, $tmpfile) = ::tempfile(SUFFIX => ".chr", UNLINK => 1);
|
my ($dummy_fh, $tmpfile) = ::tempfile(SUFFIX => ".chr");
|
||||||
$command = qq{
|
$command = qq{
|
||||||
sh -c 'dd bs=1 count=1 of=$tmpfile 2>/dev/null';
|
sh -c 'dd bs=1 count=1 of=$tmpfile 2>/dev/null';
|
||||||
test \! -s "$tmpfile" && rm -f "$tmpfile" && exec true;
|
test \! -s "$tmpfile" && rm -f "$tmpfile" && exec true;
|
||||||
|
|
|
@ -141,4 +141,7 @@ echo '### Negative replacement strings'
|
||||||
parallel --colsep ' ' echo '{2} + {4} = {2} + {-1}=' '$(( {2} + {-1} ))' ::: "1 2 3 4"
|
parallel --colsep ' ' echo '{2} + {4} = {2} + {-1}=' '$(( {2} + {-1} ))' ::: "1 2 3 4"
|
||||||
parallel --colsep ' ' echo '{-3}orrect' ::: "1 c 3 4"
|
parallel --colsep ' ' echo '{-3}orrect' ::: "1 c 3 4"
|
||||||
|
|
||||||
|
echo 'bug #38439: "open files" with --files --pipe blocks after a while'
|
||||||
|
ulimit -n 15; yes |head -n 10M | parallel-20120822 --pipe -k echo {#} of 21
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -237,3 +237,25 @@ correct
|
||||||
correct
|
correct
|
||||||
2 + 4 = 2 + 4= 6
|
2 + 4 = 2 + 4= 6
|
||||||
correct
|
correct
|
||||||
|
bug #38439: "open files" with --files --pipe blocks after a while
|
||||||
|
1 of 21
|
||||||
|
2 of 21
|
||||||
|
3 of 21
|
||||||
|
4 of 21
|
||||||
|
5 of 21
|
||||||
|
6 of 21
|
||||||
|
7 of 21
|
||||||
|
8 of 21
|
||||||
|
9 of 21
|
||||||
|
10 of 21
|
||||||
|
11 of 21
|
||||||
|
12 of 21
|
||||||
|
13 of 21
|
||||||
|
14 of 21
|
||||||
|
15 of 21
|
||||||
|
16 of 21
|
||||||
|
17 of 21
|
||||||
|
18 of 21
|
||||||
|
19 of 21
|
||||||
|
20 of 21
|
||||||
|
21 of 21
|
||||||
|
|
Loading…
Reference in a new issue