Skip to content

Commit

Permalink
Merge pull request #13905 from mvdbeek/suppress_trap_failure
Browse files Browse the repository at this point in the history
[22.01] Redirect stderr of trap cleanup
  • Loading branch information
bgruening authored May 11, 2022
2 parents 3dbae41 + 853ef69 commit 0ac6f41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/jobs/command_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def capture_stdout_stderr(self, stdout_file, stderr_file):
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"
Expand Down
2 changes: 1 addition & 1 deletion test/unit/app/jobs/test_command_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_kill_trap_replaced(self):
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)

Expand Down

0 comments on commit 0ac6f41

Please sign in to comment.