Skip to content

WIP: Fix bash echo statement exit code

What does this MR do?

  • Wraps an echo statement and restores the previous commands exit code, so that the echo statement itself doesn't interfere.
    • Store current exit code
    • Echo statement to be run
    • Restore exit code (using a subshell (exit $code)).

Why was this MR needed?

#25394 (closed)

What's the best way to test this MR?

TODO: Add unit test.

Manual test: This should fail:

  script:
    - "false"
    - echo $?

This should succeed:

  script:
    - "true"
    - echo $?

What are the relevant issue numbers?

Closes #25394 (closed)

Merge request reports