From 4688ba04c9a5d734cee25af7de36a8eda5ad3e01 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Mon, 26 Nov 2012 21:19:14 +0100 Subject: [PATCH] parallel: Fixed bug #37680: --wd ... not working --- src/parallel | 6 +++++- testsuite/tests-to-run/test35.sh | 4 ++++ testsuite/wanted-results/test35 | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/parallel b/src/parallel index da6a0872..21ac31e4 100755 --- a/src/parallel +++ b/src/parallel @@ -613,7 +613,7 @@ sub get_options_from_array { sub parse_options { # Returns: N/A # Defaults: - $Global::version = 20121124; + $Global::version = 20121126; $Global::progname = 'parallel'; $Global::infinity = 2**31; $Global::debug = 0; @@ -3711,6 +3711,10 @@ sub sshcleanup { $cleancmd .= "$sshcmd $serverlogin rm -f " . ::shell_quote_scalar($cleandir.$file.$removeworkdir).";"; } + if(defined $opt::workdir and $opt::workdir eq "...") { + $cleancmd .= "$sshcmd $serverlogin rm -rf " . ::shell_quote_scalar($workdir).";"; + } + return $cleancmd; } diff --git a/testsuite/tests-to-run/test35.sh b/testsuite/tests-to-run/test35.sh index 214bf573..ec9de01f 100755 --- a/testsuite/tests-to-run/test35.sh +++ b/testsuite/tests-to-run/test35.sh @@ -41,5 +41,9 @@ stdout parallel -k --wd /tmp/ --basefile 1-col.txt --trc {}.5 -S .. -v echo ">"{ # A few rmdir errors are OK as we have multiple files in the same dirs find . -name '*.5' | sort +echo '### Test --wd ... --cleanup' +stdout parallel -k --wd ... --cleanup -S lo -v echo ">"{}.6 ::: uNiQuE_sTrInG +find ~/.parallel/tmp |grep uNiQuE_sTrInG + cd .. rm -rf tmp diff --git a/testsuite/wanted-results/test35 b/testsuite/wanted-results/test35 index 90d636b3..8d4462a5 100644 --- a/testsuite/wanted-results/test35 +++ b/testsuite/wanted-results/test35 @@ -66,3 +66,5 @@ echo >./a\ b/cd\ /\ ef/efg.5 ./a b/cd / ef/efg.5 ./b/bar.5 ./b/foo.5 +### Test --wd ... --cleanup +echo >uNiQuE_sTrInG.6