File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -468,14 +468,28 @@ func (r *Runner) setupLogCapture() error {
468468func (r * Runner ) logStdout (line string ) {
469469 r .captureLogLine (line )
470470
471- _ , _ = fmt .Fprintln (os .Stdout , line ) //nolint:forbidigo // mirror log to stdout
471+ // Strip [pid=xxxxx] prefix before mirroring to stdout
472+ mirrorLine := line
473+ if LogRegex .MatchString (line ) {
474+ if m := LogRegex .FindStringSubmatch (line ); m != nil {
475+ mirrorLine = m [2 ] // Extract message without pid prefix
476+ }
477+ }
478+ _ , _ = fmt .Fprintln (os .Stdout , mirrorLine ) //nolint:forbidigo // mirror log to stdout
472479}
473480
474481// logStderr captures a line from stderr and mirrors to stderr
475482func (r * Runner ) logStderr (line string ) {
476483 r .captureLogLine (line )
477484
478- _ , _ = fmt .Fprintln (os .Stderr , line ) //nolint:forbidigo // mirror log to stderr
485+ // Strip [pid=xxxxx] prefix before mirroring to stderr
486+ mirrorLine := line
487+ if LogRegex .MatchString (line ) {
488+ if m := LogRegex .FindStringSubmatch (line ); m != nil {
489+ mirrorLine = m [2 ] // Extract message without pid prefix
490+ }
491+ }
492+ _ , _ = fmt .Fprintln (os .Stderr , mirrorLine ) //nolint:forbidigo // mirror log to stderr
479493}
480494
481495// captureLogLine handles routing log lines like the old implementation
Original file line number Diff line number Diff line change @@ -38,14 +38,14 @@ python3 -m cog.server.http \
3838EOF
3939
4040# Start Docker container
41- docker run -it --detach \
41+ docker run -it --rm -- detach \
4242 --name " $name " \
4343 --entrypoint /bin/bash \
4444 --publish " $port :$port " \
4545 --volume " $PWD " :/src python:latest \
4646 -c " $SCRIPT "
4747
48- # trap 'docker stop $name' EXIT
48+ trap ' docker stop $name' EXIT
4949
5050# Wait for server to be ready
5151sleep 3
You can’t perform that action at this time.
0 commit comments