Skip to content

Make traps work on recent Bash versions

What does this MR do?

Makes trap command to work for bash versions >=4.3 by placing eval into group command:

$ docker run --rm -i bash:4.1  <<<': | { eval "trap date EXIT"; }'
$ docker run --rm -i bash:4.2  <<<': | { eval "trap date EXIT"; }'
$ docker run --rm -i bash:4.3  <<<': | { eval "trap date EXIT"; }'
Mon Jul 23 11:18:31 UTC 2018
$ docker run --rm -i bash:4.4  <<<': | { eval "trap date EXIT"; }'
Mon Jul 23 11:18:55 UTC 2018

Why was this MR needed?

trap is useful

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

#3009 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports