feature request - provide access to stdout for successful build actions
- Dominant language
- Rust
- Stars
- 4.4k
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
By default Buck2 does not print the output of successful commands. The CLI offers some knobs to control this behavior: E.g.
`buck2 build ... -v1,stderr` or `buck2 build ... -v4` will display stderr output of build commands even if they were succesful. However, there does not seem to be a way to access the stdout output of build commands that completed successfully. Even the following log query will not include stdout output of successful commands:
```
$ buck2 log show | jq -r '
.Event.data.SpanEnd.data.ActionExecution
| try .commands[]
| ( "exit: " + (.details.signed_exit_code|tostring)
+ "\nstdout:\n" + .details.stdout
+ "\nstderr:\n" + .details.stderr
)
'
```
This was confirmed with a build action that invoked a Python wrapper script by adding a `print` command to the beginning of the Python script's main function. If the script is forced to fail by adding `sys.exit(1)`, then the stdout output is displayed by Buck2.
This was observed on regular local build actions. However, relatedly I noticed that the [persistent worker protocol](https://github.com/facebook/buck2/blob/71da19b58242cb6ad9fd4b3d126ed6d20ae659bc/app/buck2_worker_proto/worker.proto#L31) does not provide a field to communicate stdout output from the worker to Buck2. To support stdout output of commands executed by a persistent worker would require extending that protocol.
Contributor guide
Assessment
This issue has not been assessed yet.