Skip to content

Commit

Permalink
Do not close FD9 for prechecker
Browse files Browse the repository at this point in the history
Close #317
  • Loading branch information
ko1nksm committed Jun 18, 2024
1 parent 225e0f0 commit c209cb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions helper/spec_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ set -eu

# shellcheck disable=SC2039
spec_helper_precheck() {
info "shellspec minimum version: $SHELLSPEC_VERSION"
minimum_version "$SHELLSPEC_VERSION"

setenv SHELLSPEC_PRECHECK_SETENV="dummy"
unsetenv SHELLSPEC_PRECHECK_SETENV

if [ "${PIPEFAIL:-}" ]; then
# TODO: set -o pipefail will be allowed in POSIX issue 8
# shellcheck disable=SC3040
Expand Down
5 changes: 3 additions & 2 deletions libexec/shellspec-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ fi

xs=0
{
env=$( ( ( ( ( _do() { set +e; (set -e; "$@") 8>&- 9>&-; echo "xs=$?" >&9; }
_do precheck "$SHELLSPEC_REQUIRES" >&8
# precheck outputs code such as environment variable settings via FD9
env=$( ( ( ( ( set -- "$SHELLSPEC_REQUIRES"
set +e; (set -e; precheck "$@") >&8 8>&-; echo "xs=$?" >&9
) 2>&1 | while IFS= read -r line; do error "$line"; done >&2
) 3>&1 | while IFS= read -r line; do warn "$line"; done >&2
) 4>&1 | while IFS= read -r line; do info "$line"; done >&8
Expand Down

0 comments on commit c209cb4

Please sign in to comment.