Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lvmd: don't call Close() for stdout #894

Merged
merged 1 commit into from
Apr 25, 2024
Merged

Conversation

ushitora-anqou
Copy link
Contributor

The Go's reference of StdoutPipe says:

Wait will close the pipe after seeing the command exit, so most callers
need not close the pipe themselves. It is thus incorrect to call Wait
before all reads from the pipe have completed.

https://pkg.go.dev/os/exec#Cmd.StdoutPipe

So, io.ReadAll should be called instead of Close.

@ushitora-anqou ushitora-anqou marked this pull request as ready for review April 23, 2024 07:08
@ushitora-anqou ushitora-anqou requested a review from a team as a code owner April 23, 2024 07:08
@ushitora-anqou ushitora-anqou marked this pull request as draft April 23, 2024 07:21
The Go's reference of `StdoutPipe` says:

> Wait will close the pipe after seeing the command exit, so most callers
> need not close the pipe themselves. It is thus incorrect to call Wait
> before all reads from the pipe have completed.

https://pkg.go.dev/os/exec#Cmd.StdoutPipe

So we don't have to call Close() for stdout.

Signed-off-by: Ryotaro Banno <ryotaro.banno@gmail.com>
@ushitora-anqou ushitora-anqou marked this pull request as ready for review April 23, 2024 08:06
@ushitora-anqou ushitora-anqou marked this pull request as draft April 23, 2024 08:06
@ushitora-anqou ushitora-anqou changed the title lvmd: call io.ReadAll for stdout instead of Close lvmd: don't call Close() for stdout Apr 25, 2024
@ushitora-anqou ushitora-anqou marked this pull request as ready for review April 25, 2024 01:30
@toshipp toshipp merged commit c29402b into main Apr 25, 2024
24 checks passed
@toshipp toshipp deleted the lvmd-read-all-from-stdout branch April 25, 2024 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants