diff --git a/src/env_parallel.bash b/src/env_parallel.bash index ca0b0b3c..e34796f3 100755 --- a/src/env_parallel.bash +++ b/src/env_parallel.bash @@ -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 - return 255 - fi - if which parallel >/dev/null; then - true which on linux - else + + # Bash 'which' is broken in version 3.2.25 and 4.2.39 + # The crazy '[ "`...`" == "" ]' is needed for the same reason + if [ "`which parallel`" == "" ]; then echo 'env_parallel: Error: parallel must be in $PATH.' >&2 return 255 fi @@ -115,7 +112,7 @@ env_parallel() { _ignore_UNDERSCORE="`_get_ignored_VARS \"$@\"`" # --record-env - if perl -e 'exit grep { /^--record-env$/ } @ARGV' -- "$@"; then + if [ "`perl -e 'exit grep { /^--record-env$/ } @ARGV' -- "$@"; echo $?`" == 0 ] ; then true skip else (_names_of_ALIASES; @@ -152,6 +149,7 @@ env_parallel() { fi unset _variable_NAMES + _which_true="`which true`" # Copy shopt (so e.g. extended globbing works) # But force expand_aliases as aliases otherwise do not work PARALLEL_ENV="` @@ -165,7 +163,7 @@ env_parallel() { unset _list_variable_VALUES unset _list_function_BODIES # Test if environment is too big - if `which true` >/dev/null ; then + if [ "`which true`" == "$_which_true" ] ; then `which parallel` "$@"; _parallel_exit_CODE=$? unset PARALLEL_ENV; diff --git a/src/parallel b/src/parallel index 398d6008..0cd21061 100755 --- a/src/parallel +++ b/src/parallel @@ -1376,7 +1376,7 @@ sub check_invalid_option_combinations { sub init_globals { # Defaults: - $Global::version = 20170624; + $Global::version = 20170706; $Global::progname = 'parallel'; $Global::infinity = 2**31; $Global::debug = 0; diff --git a/testsuite/tests-to-run/parallel-polarhome.sh b/testsuite/tests-to-run/parallel-polarhome.sh index 40079a76..bfd54ebf 100755 --- a/testsuite/tests-to-run/parallel-polarhome.sh +++ b/testsuite/tests-to-run/parallel-polarhome.sh @@ -66,6 +66,21 @@ echo '### Does PARALLEL_SHELL help exporting a bash function not kill parallel' 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 +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 wait; cat /tmp/test_empty_cmd rm /tmp/test_empty_cmd