jesseduffield.lazygit/pkg/commands
Stefan Haller a61be44e92 Wait for the streamed command's output goroutine before reading its buffers
runAndStreamAux reads the stdout buffer (and, when output is suppressed,
the combinedOutput buffer) for its error message after handler.wait()
returns, but the goroutine that fills those buffers by draining the
command's output isn't awaited, so the reads raced its final writes.

Own the goroutine here rather than letting the onRun callbacks spawn it,
and join it before reading the buffers. The pty reader reaches EOF on its
own once the process exits, but the non-pty pipe never does, so its
handler now closes the read end to unblock the reader; the pipe is
synchronous, so by the time the command has exited all of its output has
already been read and nothing is lost. This also plugs the goroutine that
the non-pty streaming path previously leaked on every command.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 12:19:14 +02:00
..
direnv Offer direnv .envrc approval from inside lazygit 2026-06-04 09:05:01 +02:00
git_commands Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
git_config Enable errorlint linter, and fix warnings 2025-06-30 18:30:11 +02:00
hosting_service Optimize regex compilations 2026-05-10 15:28:14 +02:00
models Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
oscommands Wait for the streamed command's output goroutine before reading its buffers 2026-07-17 12:19:14 +02:00
patch Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
testdata Support opening lazygit in a submodule 2019-05-12 17:59:49 +10:00
git.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
git_cmd_obj_builder.go Back off exponentially between lock-error retries 2026-07-15 10:08:44 +02:00
git_cmd_obj_builder_test.go Suppress optional locks by default again, except foreground refresh 2026-07-02 16:05:08 +02:00
git_cmd_obj_runner.go Back off exponentially between lock-error retries 2026-07-15 10:08:44 +02:00
git_cmd_obj_runner_test.go Back off exponentially between lock-error retries 2026-07-15 10:08:44 +02:00