Skip to content

Commit 66b6fbc

Browse files
committed
Allow child bashio processes to access the parent LOG_FD variable
1 parent d9f9ee5 commit 66b6fbc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/log.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
# ==============================================================================
99

1010
# Unless $LOG_FD is already set to a valid fd
11-
if ! [[ "${LOG_FD-}" =~ ^[0-9]+$ ]] || ! { : >&"${LOG_FD-2}"; } 2>/dev/null; then
11+
if ! [[ "${LOG_FD:-}" =~ ^[0-9]+$ ]] || ! { : >&"${LOG_FD:-}"; } 2>/dev/null; then
1212
# Preserve the original STDOUT on a free fd (stored in $LOG_FD) so that we can
13-
# log to it without interfering with the STDOUT of subshells whose output we
14-
# want to capture for other purposes.
13+
# log to it without interfering with the STDOUT of subshells or child processes
14+
# whose output we want to capture for other purposes.
1515
exec {LOG_FD}>&1
16+
# Export LOG_FD for use by child bashio processes.
17+
export LOG_FD
1618
fi
1719

1820
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)