Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jandubois
Copy link
Contributor

  • Set BATS_RUN_ERREXIT environment variable when flag is provided.
  • Write $? to a temp file when errexit is enabled.

I've tried for several hours, but have been unable to find a solution without using a temp file. I don't quite understand why, but I couldn't make it work.

Fixes #719
Fixes #748


@jandubois jandubois requested a review from a team as a code owner July 27, 2025 06:02
Set BATS_RUN_ERREXIT environment variable when flag is provided.
Write $? to a temp file when errexit is enabled.

Fixes bats-core#719
Fixes bats-core#748

Signed-off-by: Jan Dubois <[email protected]>
@jandubois
Copy link
Contributor Author

jandubois commented Jul 27, 2025

I believe I have addressed all failures found by CI related to the PR.

  • The Windows tests are cancelled because the windows-2019 runner has been retired.
  • The Dockerfile test failure seems unrelated to the changes in this PR and fails on other PRs too.

@brokenpip3
Copy link
Contributor

I believe I have addressed all failures found by CI related to the PR.

* The Windows tests are cancelled because the windows-2019 runner has been retired.

* The Dockerfile test failure seems unrelated to the changes in this PR and fails on other PRs too.

yes indeed, will take a look

@jandubois
Copy link
Contributor Author

I added another commit to the PR to make sure the tmp directory exists. Otherwise it can fail when run() is called outside a @test block (which maybe you are not supposed to do, but it works):

# .../bats-core/test_functions.bash: line 396: BATS_FILE_TMPDIR: unbound variable

This was already broken if you called run() with --separate-stderr ourside a @test block, and is fixed here as well.

@AkihiroSuda
Copy link

Maybe rebase to pass the CI ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow for set -e in run errexit is ignored in functions executed via run

3 participants