Skip to content

Flush stdout and stderr before sending exit code - #25

Merged
mattn merged 1 commit into
masterfrom
fix-flush-before-exit
Jul 10, 2026
Merged

Flush stdout and stderr before sending exit code#25
mattn merged 1 commit into
masterfrom
fix-flush-before-exit

Conversation

@mattn

@mattn mattn commented Jul 10, 2026

Copy link
Copy Markdown
Owner

The client sent the exit message as soon as cmd.Run() returned, but the stdout/stderr writer goroutines might not have finished encoding the final chunk of output. Since the server returns immediately on the exit message, trailing output could be dropped.

Make msgWrite's Close block until the writer goroutine has drained, and close the stdout/stderr writers before encoding the exit code.

@mattn
mattn merged commit 5698e97 into master Jul 10, 2026
2 checks passed
@mattn
mattn deleted the fix-flush-before-exit branch July 10, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant