Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions prefix-output.sh
Original file line number Diff line number Diff line change
@@ -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)
Comment thread
msukkari marked this conversation as resolved.

exec "$@"
fi