Skip to content

Commit 34b1f49

Browse files
committed
fix prefix issue
1 parent a3d9711 commit 34b1f49

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

prefix-output.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
#!/bin/sh
22

33
# @see : https://github.com/Supervisor/supervisor/issues/553#issuecomment-1353523182
4-
exec 1> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&1)
5-
exec 2> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&2)
64

7-
exec "$@"
5+
# Check if structured logging is enabled
6+
if [ "${SOURCEBOT_STRUCTURED_LOGGING_ENABLED}" = "true" ]; then
7+
# Don't prefix output, just execute the command directly
8+
exec "$@"
9+
else
10+
# Apply prefix to output
11+
exec 1> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&1)
12+
exec 2> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&2)
13+
14+
exec "$@"
15+
fi

0 commit comments

Comments
 (0)