mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-24 15:07:55 +00:00
parallel: echo is not always in /bin/echo, so use which echo
.
This commit is contained in:
parent
09d0ee1c73
commit
ec20263343
12
src/parallel
12
src/parallel
|
@ -5634,7 +5634,7 @@ sub which(@) {
|
||||||
push(@which, grep { not -d $_ and -x $_ }
|
push(@which, grep { not -d $_ and -x $_ }
|
||||||
map { $_."/".$prg } split(":",$ENV{'PATH'}));
|
map { $_."/".$prg } split(":",$ENV{'PATH'}));
|
||||||
if($prg =~ m:/:) {
|
if($prg =~ m:/:) {
|
||||||
# Including path
|
# Test if program with full path exists
|
||||||
push(@which, grep { not -d $_ and -x $_ } $prg);
|
push(@which, grep { not -d $_ and -x $_ } $prg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11663,7 +11663,8 @@ sub find_max($) {
|
||||||
if($len > $upper) { return $len };
|
if($len > $upper) { return $len };
|
||||||
$len *= 16;
|
$len *= 16;
|
||||||
} while (is_acceptable_command_line_length($len,$string));
|
} while (is_acceptable_command_line_length($len,$string));
|
||||||
# Then search for the actual max length between 0 and upper bound
|
# Then search for the actual max length between
|
||||||
|
# last successful length ($len/16) and upper bound
|
||||||
return binary_find_max(int($len/16),$len,$string);
|
return binary_find_max(int($len/16),$len,$string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11684,6 +11685,9 @@ sub binary_find_max($$$) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $prg;
|
||||||
|
|
||||||
sub is_acceptable_command_line_length($$) {
|
sub is_acceptable_command_line_length($$) {
|
||||||
# Test if a command line of this length can run
|
# Test if a command line of this length can run
|
||||||
# in the current environment
|
# in the current environment
|
||||||
|
@ -11697,10 +11701,12 @@ sub is_acceptable_command_line_length($$) {
|
||||||
$len += length $Global::parallel_env;
|
$len += length $Global::parallel_env;
|
||||||
}
|
}
|
||||||
# Force using non-built-in command
|
# Force using non-built-in command
|
||||||
::qqx("/bin/echo ".${string}x(($len-length "/bin/echo ")/length $string));
|
$prg ||= ::which("echo");
|
||||||
|
::qqx("$prg ".${string}x(($len-1-length $prg)/length $string));
|
||||||
::debug("init", "$len=$? ");
|
::debug("init", "$len=$? ");
|
||||||
return not $?;
|
return not $?;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub tmux_length($) {
|
sub tmux_length($) {
|
||||||
# If $opt::tmux set, find the limit for tmux
|
# If $opt::tmux set, find the limit for tmux
|
||||||
|
|
Loading…
Reference in a new issue