mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
Fixed env_parallel not working on old versions of Bash.
https://lists.gnu.org/archive/html/bug-parallel/2017-07/msg00000.html
This commit is contained in:
parent
8e22009706
commit
10b4539b1f
|
@ -97,13 +97,10 @@ env_parallel() {
|
||||||
' -- "$@"
|
' -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if which parallel | grep 'no parallel in' >/dev/null; then
|
|
||||||
echo 'env_parallel: Error: parallel must be in $PATH.' >&2
|
# Bash 'which' is broken in version 3.2.25 and 4.2.39
|
||||||
return 255
|
# The crazy '[ "`...`" == "" ]' is needed for the same reason
|
||||||
fi
|
if [ "`which parallel`" == "" ]; then
|
||||||
if which parallel >/dev/null; then
|
|
||||||
true which on linux
|
|
||||||
else
|
|
||||||
echo 'env_parallel: Error: parallel must be in $PATH.' >&2
|
echo 'env_parallel: Error: parallel must be in $PATH.' >&2
|
||||||
return 255
|
return 255
|
||||||
fi
|
fi
|
||||||
|
@ -115,7 +112,7 @@ env_parallel() {
|
||||||
_ignore_UNDERSCORE="`_get_ignored_VARS \"$@\"`"
|
_ignore_UNDERSCORE="`_get_ignored_VARS \"$@\"`"
|
||||||
|
|
||||||
# --record-env
|
# --record-env
|
||||||
if perl -e 'exit grep { /^--record-env$/ } @ARGV' -- "$@"; then
|
if [ "`perl -e 'exit grep { /^--record-env$/ } @ARGV' -- "$@"; echo $?`" == 0 ] ; then
|
||||||
true skip
|
true skip
|
||||||
else
|
else
|
||||||
(_names_of_ALIASES;
|
(_names_of_ALIASES;
|
||||||
|
@ -152,6 +149,7 @@ env_parallel() {
|
||||||
fi
|
fi
|
||||||
unset _variable_NAMES
|
unset _variable_NAMES
|
||||||
|
|
||||||
|
_which_true="`which true`"
|
||||||
# Copy shopt (so e.g. extended globbing works)
|
# Copy shopt (so e.g. extended globbing works)
|
||||||
# But force expand_aliases as aliases otherwise do not work
|
# But force expand_aliases as aliases otherwise do not work
|
||||||
PARALLEL_ENV="`
|
PARALLEL_ENV="`
|
||||||
|
@ -165,7 +163,7 @@ env_parallel() {
|
||||||
unset _list_variable_VALUES
|
unset _list_variable_VALUES
|
||||||
unset _list_function_BODIES
|
unset _list_function_BODIES
|
||||||
# Test if environment is too big
|
# Test if environment is too big
|
||||||
if `which true` >/dev/null ; then
|
if [ "`which true`" == "$_which_true" ] ; then
|
||||||
`which parallel` "$@";
|
`which parallel` "$@";
|
||||||
_parallel_exit_CODE=$?
|
_parallel_exit_CODE=$?
|
||||||
unset PARALLEL_ENV;
|
unset PARALLEL_ENV;
|
||||||
|
|
|
@ -1376,7 +1376,7 @@ sub check_invalid_option_combinations {
|
||||||
|
|
||||||
sub init_globals {
|
sub init_globals {
|
||||||
# Defaults:
|
# Defaults:
|
||||||
$Global::version = 20170624;
|
$Global::version = 20170706;
|
||||||
$Global::progname = 'parallel';
|
$Global::progname = 'parallel';
|
||||||
$Global::infinity = 2**31;
|
$Global::infinity = 2**31;
|
||||||
$Global::debug = 0;
|
$Global::debug = 0;
|
||||||
|
|
|
@ -66,6 +66,21 @@ echo '### Does PARALLEL_SHELL help exporting a bash function not kill parallel'
|
||||||
echo
|
echo
|
||||||
PARALLEL_SHELL=/bin/bash parallel --retries $RETRIES --onall -j0 -k --tag --timeout $TIMEOUT $S_POLAR 'func() { cat <(echo bash only B); };export -f func; bin/parallel func ::: ' ::: 1 2>&1 | sort
|
PARALLEL_SHELL=/bin/bash parallel --retries $RETRIES --onall -j0 -k --tag --timeout $TIMEOUT $S_POLAR 'func() { cat <(echo bash only B); };export -f func; bin/parallel func ::: ' ::: 1 2>&1 | sort
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo '### env_parallel echo :::: <(echo OK)'
|
||||||
|
echo '(bash only)'
|
||||||
|
echo
|
||||||
|
parallel --retries $RETRIES --onall -j0 -k --tag --timeout $TIMEOUT $S_POLAR 'bin/env_parallel --install'
|
||||||
|
parallel --retries $RETRIES --onall -j0 -k --tag --timeout $TIMEOUT $S_POLAR 'env_parallel echo env_parallel ::: OK'
|
||||||
|
parallel --retries $RETRIES --onall -j0 -k --tag --timeout $TIMEOUT $S_POLAR 'env_parallel echo reading from process substitution :::: <(echo OK)'
|
||||||
|
|
||||||
|
# eval 'myfunc() { echo '$(perl -e 'print "x"x20000')'; }'
|
||||||
|
# env_parallel myfunc ::: a | wc # OK
|
||||||
|
# eval 'myfunc2() { echo '$(perl -e 'print "x"x120000')'; }'
|
||||||
|
# env_parallel myfunc ::: a | wc # Fail too big env
|
||||||
|
# Can this be made faster using `ssh -M`?
|
||||||
|
# Can it be moved to virtualbox?
|
||||||
|
|
||||||
# Started earlier - therefore wait
|
# Started earlier - therefore wait
|
||||||
wait; cat /tmp/test_empty_cmd
|
wait; cat /tmp/test_empty_cmd
|
||||||
rm /tmp/test_empty_cmd
|
rm /tmp/test_empty_cmd
|
||||||
|
|
Loading…
Reference in a new issue