fix prefix issue

This commit is contained in:
msukkari 2025-08-07 10:34:14 -07:00
parent a3d9711178
commit 34b1f4976c

View file

@ -1,7 +1,15 @@
#!/bin/sh
# @see : https://github.com/Supervisor/supervisor/issues/553#issuecomment-1353523182
exec 1> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&1)
exec 2> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&2)
exec "$@"
# Check if structured logging is enabled
if [ "${SOURCEBOT_STRUCTURED_LOGGING_ENABLED}" = "true" ]; then
# Don't prefix output, just execute the command directly
exec "$@"
else
# Apply prefix to output
exec 1> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&1)
exec 2> >( perl -ne '$| = 1; print "['"${SUPERVISOR_PROCESS_NAME}"'] | $_"' >&2)
exec "$@"
fi