mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 13:17:54 +00:00
Fixed: bug #46679: Problems exporting bash functions to /bin/sh.
This commit is contained in:
parent
b17f41d17f
commit
3d919c6cd4
25
src/parallel
25
src/parallel
|
@ -3760,16 +3760,23 @@ sub tmpfifo {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub qqx {
|
sub qqx {
|
||||||
# Like qx but with clean environment (except for $PATH)
|
# Like qx but with clean environment (except for @keep)
|
||||||
# and STDERR ignored
|
# and STDERR ignored
|
||||||
# This is needed if the environment contains functions
|
# This is needed if the environment contains functions
|
||||||
# that /bin/sh does not understand
|
# that /bin/sh does not understand
|
||||||
my $devnull = $Global::debug ? "" : "exec 2>/dev/null;";
|
|
||||||
return qx{ $devnull @_ };
|
|
||||||
my $PATH = $ENV{'PATH'};
|
my $PATH = $ENV{'PATH'};
|
||||||
|
my %env;
|
||||||
|
my @keep = qw(PATH SSH_AUTH_SOCK SSH_AGENT_PID);
|
||||||
|
@env{@keep} = @ENV{@keep};
|
||||||
local(%ENV);
|
local(%ENV);
|
||||||
$ENV{'PATH'} = $PATH;
|
%ENV = %env;
|
||||||
return qx{ ( @_ ) 2>/dev/null };
|
if($Global::debug) {
|
||||||
|
return qx{ @_ && true };
|
||||||
|
} else {
|
||||||
|
local *STDERR;
|
||||||
|
open (STDERR, ">", "/dev/null");
|
||||||
|
return qx{ @_ };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub uniq {
|
sub uniq {
|
||||||
|
@ -9082,15 +9089,13 @@ sub binary_find_max_length {
|
||||||
|
|
||||||
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
|
||||||
# Returns:
|
# Returns:
|
||||||
# 0 if the command line length is too long
|
# 0 if the command line length is too long
|
||||||
# 1 otherwise
|
# 1 otherwise
|
||||||
my $len = shift;
|
my $len = shift;
|
||||||
|
$len += length $ENV{PARALLEL_ENV} + (-s $ENV{PARALLEL_ENV})*2;
|
||||||
local *STDERR;
|
::qqx("true "."x"x$len);
|
||||||
open (STDERR, ">", "/dev/null");
|
|
||||||
system "true "."x"x$len;
|
|
||||||
close STDERR;
|
|
||||||
::debug("init", "$len=$? ");
|
::debug("init", "$len=$? ");
|
||||||
return not $?;
|
return not $?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue