Redirect stderr of trap cleanup

Prevents
```
rm: cannot remove '/data/jwd/main/046/709/46709070/tmp/out.471762': No such file or directory
rm: cannot remove '/data/jwd/main/046/709/46709070/tmp/err.471762': No such file or directory
```
reported in https://github.com/galaxyproject/galaxy/issues/13902.

I don't think this is what fails the job, there is likely something else
wrong on top of this.
This commit is contained in:
mvdbeek
2022-05-11 10:52:39 +02:00
parent be45760c27
commit 853ef69d02
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -282,7 +282,7 @@ class CommandsBuilder:
if TRAP_KILL_CONTAINER in self.commands:
# We need to replace the container kill trap with one that removes the named pipes and kills the container
self.commands = self.commands.replace(TRAP_KILL_CONTAINER, "")
trap_command = """trap 'rm "$__out" "$__err"; _on_exit' EXIT"""
trap_command = """trap 'rm "$__out" "$__err" 2> /dev/null || true; _on_exit' EXIT"""
self.prepend_command(
f"""__out="${{TMPDIR:-.}}/out.$$" __err="${{TMPDIR:-.}}/err.$$"
mkfifo "$__out" "$__err"
+1 -1
View File
@@ -54,7 +54,7 @@ class TestCommandFactory(TestCase):
self.job_wrapper.command_line = f"{TRAP_KILL_CONTAINER}{MOCK_COMMAND_LINE}"
expected_command_line = self._surround_command(MOCK_COMMAND_LINE).replace(
"""trap 'rm "$__out" "$__err"' EXIT""",
"""trap 'rm "$__out" "$__err"; _on_exit' EXIT"""
"""trap 'rm "$__out" "$__err" 2> /dev/null || true; _on_exit' EXIT"""
)
self.__assert_command_is(expected_command_line)