Skip to content

Commit

Permalink
Only use sudo rm with docker #1956 [ci fast]
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Mar 19, 2021
1 parent aff1d35 commit f949042
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class BashWrapperBuilder {
String result = ''
// -- cleanup the scratch dir
if( scratch && cleanup != false ) {
result += (!containerBuilder ? 'rm -rf $NXF_SCRATCH || true' : '(sudo -n true && sudo rm -rf "$NXF_SCRATCH" || rm -rf "$NXF_SCRATCH")&>/dev/null || true')
result += (containerBuilder !instanceof DockerBuilder ? 'rm -rf $NXF_SCRATCH || true' : '(sudo -n true && sudo rm -rf "$NXF_SCRATCH" || rm -rf "$NXF_SCRATCH")&>/dev/null || true')
result += '\n'
}
// -- remove the container in this way because 'docker run --rm' fail in some cases -- see https://groups.google.com/d/msg/docker-user/0Ayim0wv2Ls/-mZ-ymGwg8EJ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ class BashWrapperBuilderTest extends Specification {

then:
binding.launch_cmd == 'podman run -i -v /work/dir:/work/dir -v "$PWD":"$PWD" -w "$PWD" --entrypoint /bin/bash --name $NXF_BOXID busybox -c "/bin/bash -ue /work/dir/.command.sh"'
binding.cleanup_cmd == '(sudo -n true && sudo rm -rf "$NXF_SCRATCH" || rm -rf "$NXF_SCRATCH")&>/dev/null || true\npodman rm $NXF_BOXID &>/dev/null || true\n'
binding.cleanup_cmd == 'rm -rf $NXF_SCRATCH || true\npodman rm $NXF_BOXID &>/dev/null || true\n'
binding.kill_cmd == 'podman kill $NXF_BOXID'
}
}

0 comments on commit f949042

Please sign in to comment.