Skip to content

Commit

Permalink
🐛 fixing log FD as file not appending
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaillon committed May 27, 2024
1 parent 4f650c7 commit edcafd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion valet.d/core
Original file line number Diff line number Diff line change
Expand Up @@ -1200,8 +1200,17 @@ if [[ ${VALET_VERY_VERBOSE:-} == "true" ]]; then
log::setLevel trace
fi
if [[ -n "${VALET_CONFIG_LOG_FD:-}" ]]; then
_INVALID_FD=false
# make sure the file descriptor is valid
if ! { : >&"${VALET_CONFIG_LOG_FD}"; } 2>/dev/null; then
if [[ ! "${VALET_CONFIG_LOG_FD}" =~ ^[0-9]+$ ]]; then
# it is a file
if ! { : >>"${VALET_CONFIG_LOG_FD}"; } 2>/dev/null; then
_INVALID_FD=true
fi
elif ! { : >&"${VALET_CONFIG_LOG_FD}"; } 2>/dev/null; then
_INVALID_FD=true
fi
if [[ ${_INVALID_FD} == "true" ]]; then
_ORIGINAL_FD="${VALET_CONFIG_LOG_FD}"
VALET_CONFIG_LOG_FD=2
core::fail "The file descriptor VALET_CONFIG_LOG_FD=⌜${_ORIGINAL_FD}⌝ is not valid."
Expand Down
2 changes: 1 addition & 1 deletion valet.d/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.15.14
0.15.23

0 comments on commit edcafd4

Please sign in to comment.