mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 05:57:54 +00:00
Fixed env_parallel does not respect exit code from functions.
http://lists.gnu.org/archive/html/bug-parallel/2016-10/msg00001.html
This commit is contained in:
parent
0f8d12839f
commit
089fc5b287
|
@ -110,5 +110,7 @@ env_parallel() {
|
|||
unset _list_variable_VALUES
|
||||
unset _list_function_BODIES
|
||||
`which parallel` "$@";
|
||||
_parallel_exit_CODE=$?
|
||||
unset PARALLEL_ENV;
|
||||
return $_parallel_exit_CODE
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
# or write to the Free Software Foundation, Inc., 51 Franklin St,
|
||||
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
set _parallel_exit_CODE=0
|
||||
if ("`alias env_parallel`" == '') then
|
||||
# Activate alias
|
||||
alias env_parallel 'setenv PARALLEL "\!*"; source `which env_parallel.csh`'
|
||||
|
@ -127,9 +128,11 @@ else
|
|||
unset _tMpaLLfILe;
|
||||
# Use $PARALLEL set in calling alias
|
||||
parallel
|
||||
set _parallel_exit_CODE=$status
|
||||
setenv PARALLEL_ENV
|
||||
setenv PARALLEL
|
||||
endif
|
||||
sh -c "exit 0$_parallel_exit_CODE"
|
||||
|
||||
# Tested working for aliases
|
||||
# alias env_parallel 'setenv PARALLEL_ENV "`alias | perl -pe s/\\047/\\047\\042\\047\\042\\047/g\;s/\^\(\\S+\)\(\\s+\)\\\(\(.\*\)\\\)/\\1\\2\\3/\;s/\^\(\\S+\)\(\\s+\)\(.\*\)/\\1\\2\\047\\3\\047/\;s/\^/\\001alias\ /\;s/\\\!/\\\\\\\!/g;`";parallel \!*; setenv PARALLEL_ENV'
|
||||
|
|
|
@ -128,5 +128,7 @@ function env_parallel
|
|||
s/\n/\001/'
|
||||
)
|
||||
parallel $argv;
|
||||
set _parallel_exit_CODE $status
|
||||
set -e PARALLEL_ENV
|
||||
return $_parallel_exit_CODE
|
||||
end
|
||||
|
|
|
@ -103,5 +103,7 @@ env_parallel() {
|
|||
unset _list_variable_VALUES
|
||||
unset _list_function_BODIES
|
||||
`which parallel` "$@";
|
||||
_parallel_exit_CODE=$?
|
||||
unset PARALLEL_ENV;
|
||||
return $_parallel_exit_CODE
|
||||
}
|
||||
|
|
|
@ -108,5 +108,7 @@ env_parallel() {
|
|||
unset _list_variable_VALUES
|
||||
unset _list_function_BODIES
|
||||
`which parallel` "$@";
|
||||
_parallel_exit_CODE=$?
|
||||
unset PARALLEL_ENV;
|
||||
return $_parallel_exit_CODE
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
# or write to the Free Software Foundation, Inc., 51 Franklin St,
|
||||
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
set _parallel_exit_CODE=0
|
||||
if ("`alias env_parallel`" == '') then
|
||||
# Activate alias
|
||||
alias env_parallel 'setenv PARALLEL "\!*"; source `which env_parallel.tcsh`'
|
||||
|
@ -127,9 +128,11 @@ else
|
|||
unset _tMpaLLfILe;
|
||||
# Use $PARALLEL set in calling alias
|
||||
parallel
|
||||
set _parallel_exit_CODE=$status
|
||||
setenv PARALLEL_ENV
|
||||
setenv PARALLEL
|
||||
endif
|
||||
sh -c "exit 0$_parallel_exit_CODE"
|
||||
|
||||
# Tested working for aliases
|
||||
# alias env_parallel 'setenv PARALLEL_ENV "`alias | perl -pe s/\\047/\\047\\042\\047\\042\\047/g\;s/\^\(\\S+\)\(\\s+\)\\\(\(.\*\)\\\)/\\1\\2\\3/\;s/\^\(\\S+\)\(\\s+\)\(.\*\)/\\1\\2\\047\\3\\047/\;s/\^/\\001alias\ /\;s/\\\!/\\\\\\\!/g;`";parallel \!*; setenv PARALLEL_ENV'
|
||||
|
|
|
@ -109,5 +109,7 @@ env_parallel() {
|
|||
unset _list_variable_VALUES
|
||||
unset _list_function_BODIES
|
||||
`which parallel` "$@";
|
||||
_parallel_exit_CODE=$?
|
||||
unset PARALLEL_ENV;
|
||||
return $_parallel_exit_CODE
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ par_bash_man() {
|
|||
env_parallel -k -S server echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray -S server echo "\${myarray[{}]}" ::: 0 1 2
|
||||
|
||||
env_parallel ::: true false true false
|
||||
echo exit value $? should be 2
|
||||
_EOF
|
||||
)
|
||||
ssh bash@lo "$myscript"
|
||||
|
@ -70,6 +73,9 @@ par_zsh_man() {
|
|||
env_parallel -k -S server echo "\${myarray[{}]}" ::: 1 2 3;
|
||||
env_parallel -k --env myarray echo "\${myarray[{}]}" ::: 1 2 3;
|
||||
env_parallel -k --env myarray -S server echo "\${myarray[{}]}" ::: 1 2 3
|
||||
|
||||
env_parallel ::: true false true false
|
||||
echo exit value $? should be 2
|
||||
_EOF
|
||||
)
|
||||
ssh zsh@lo "$myscript"
|
||||
|
@ -107,6 +113,9 @@ par_ksh_man() {
|
|||
env_parallel -k -S server echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray -S server echo "\${myarray[{}]}" ::: 0 1 2
|
||||
|
||||
env_parallel ::: true false true false
|
||||
echo exit value $? should be 2
|
||||
_EOF
|
||||
)
|
||||
ssh ksh@lo "$myscript"
|
||||
|
@ -144,6 +153,9 @@ _disabled_pdksh_man() {
|
|||
env_parallel -k -S server echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray -S server echo "\${myarray[{}]}" ::: 0 1 2
|
||||
|
||||
env_parallel ::: true false true false
|
||||
echo exit value $? should be 2
|
||||
_EOF
|
||||
)
|
||||
ssh pdksh@lo "$myscript"
|
||||
|
@ -176,6 +188,8 @@ par_tcsh_man() {
|
|||
env_parallel -k --env myarray echo \$'{myarray[{}]}' ::: 1 2 3
|
||||
env_parallel -k --env myarray -S server echo \$'{myarray[{}]}' ::: 1 2 3
|
||||
|
||||
env_parallel ::: true false true false
|
||||
echo exit value $status should be 2
|
||||
_EOF
|
||||
)
|
||||
ssh -tt tcsh@lo "$myscript"
|
||||
|
@ -208,6 +222,8 @@ par_csh_man() {
|
|||
env_parallel -k --env myarray echo \$'{myarray[{}]}' ::: 1 2 3
|
||||
env_parallel -k --env myarray -S server echo \$'{myarray[{}]}' ::: 1 2 3
|
||||
|
||||
env_parallel ::: true false true false
|
||||
echo exit value $status should be 2
|
||||
_EOF
|
||||
)
|
||||
ssh csh@lo "$myscript"
|
||||
|
@ -244,6 +260,8 @@ par_fish_man() {
|
|||
env_parallel -k --env myarray echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -k --env myarray -S server echo '$myarray[{}]' ::: 1 2 3
|
||||
|
||||
env_parallel ::: true false true false
|
||||
echo exit value $status should be 2
|
||||
_EOF
|
||||
)
|
||||
ssh fish@lo "$myscript"
|
||||
|
|
|
@ -50,6 +50,7 @@ par_bash_man too
|
|||
par_bash_man arrays
|
||||
par_bash_man work,
|
||||
par_bash_man too
|
||||
par_bash_man exit value 2 should be 2
|
||||
par_bash_underscore ### bash
|
||||
par_bash_underscore ### Testing of --env _
|
||||
par_bash_underscore variables in aliases in and arrays in functions work
|
||||
|
@ -62,13 +63,13 @@ par_bash_underscore aliases in and arrays in functions work
|
|||
par_bash_underscore aliases in and arrays in functions work
|
||||
par_bash_underscore aliases in functions work
|
||||
par_bash_underscore aliases in functions work
|
||||
par_bash_underscore /bin/bash: line 70: myecho: command not found
|
||||
par_bash_underscore /bin/bash: line 71: myecho: command not found
|
||||
par_bash_underscore OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 70: myecho: command not found
|
||||
par_bash_underscore /bin/bash: line 71: myecho: command not found
|
||||
par_bash_underscore OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 68: myfunc: command not found
|
||||
par_bash_underscore /bin/bash: line 69: myfunc: command not found
|
||||
par_bash_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 68: myfunc: command not found
|
||||
par_bash_underscore /bin/bash: line 69: myfunc: command not found
|
||||
par_bash_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_csh_funky 3 arg alias_works
|
||||
par_csh_funky myvar works
|
||||
|
@ -103,6 +104,7 @@ par_csh_man too
|
|||
par_csh_man arrays
|
||||
par_csh_man work,
|
||||
par_csh_man too
|
||||
par_csh_man exit value 2 should be 2
|
||||
par_csh_underscore ### csh
|
||||
par_csh_underscore ### Testing of --env _
|
||||
par_csh_underscore #: Command not found.
|
||||
|
@ -183,6 +185,7 @@ par_fish_man too
|
|||
par_fish_man arrays
|
||||
par_fish_man work,
|
||||
par_fish_man too
|
||||
par_fish_man exit value 2 should be 2
|
||||
par_fish_underscore ### fish
|
||||
par_fish_underscore ### Testing of --env _
|
||||
par_fish_underscore variables in aliases and arrays in functions work
|
||||
|
@ -262,6 +265,7 @@ par_ksh_man too
|
|||
par_ksh_man arrays
|
||||
par_ksh_man work,
|
||||
par_ksh_man too
|
||||
par_ksh_man exit value 2 should be 2
|
||||
par_ksh_underscore ### ksh
|
||||
par_ksh_underscore ### Testing of --env _
|
||||
par_ksh_underscore variables in aliases in and arrays in functions work
|
||||
|
@ -274,13 +278,13 @@ par_ksh_underscore aliases in and arrays in functions work
|
|||
par_ksh_underscore aliases in and arrays in functions work
|
||||
par_ksh_underscore aliases in functions work
|
||||
par_ksh_underscore aliases in functions work
|
||||
par_ksh_underscore /usr/bin/ksh[113]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore /usr/bin/ksh[114]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore OK if no myecho ^^^^^^^^^^^^^^^^^
|
||||
par_ksh_underscore /usr/bin/ksh[113]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore /usr/bin/ksh[114]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore OK if no myecho ^^^^^^^^^^^^^^^^^
|
||||
par_ksh_underscore /usr/bin/ksh: line 113: myfunc: not found
|
||||
par_ksh_underscore /usr/bin/ksh: line 114: myfunc: not found
|
||||
par_ksh_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^
|
||||
par_ksh_underscore /usr/bin/ksh: line 113: myfunc: not found
|
||||
par_ksh_underscore /usr/bin/ksh: line 114: myfunc: not found
|
||||
par_ksh_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^
|
||||
par_tcsh_funky
|
||||
par_tcsh_funky
|
||||
|
@ -320,6 +324,7 @@ par_tcsh_man too
|
|||
par_tcsh_man arrays
|
||||
par_tcsh_man work,
|
||||
par_tcsh_man too
|
||||
par_tcsh_man exit value 2 should be 2
|
||||
par_tcsh_man Connection to lo closed.
|
||||
par_tcsh_underscore ### tcsh
|
||||
par_tcsh_underscore ### Testing of --env _
|
||||
|
@ -384,6 +389,7 @@ par_zsh_man too
|
|||
par_zsh_man arrays
|
||||
par_zsh_man work,
|
||||
par_zsh_man too
|
||||
par_zsh_man exit value 2 should be 2
|
||||
par_zsh_underscore ### zsh
|
||||
par_zsh_underscore ### Testing of --env _
|
||||
par_zsh_underscore variables in aliases in and arrays in functions work
|
||||
|
|
Loading…
Reference in a new issue