Repository navigation
feat: add ability to combine outputs in WithExec - #10924
Conversation
|
The PR's behaviour is to redirect standard error to standard output so combined output can be retrieved using ❓ Should |
|
Nice, wanted this for a while, thanks for picking it up! Related issue: #3496 API wise it feels confusing to call I think we could change the engine to just always write a combined output file in addition to the separate ones, and just add a getter for it: dagger/engine/buildkit/executor_spec.go Lines 572 to 584 in d6553a4 Then you can just call We'll be storing extra data for each command but it seems a small price to pay for the simplicity imo. |
That's why I haven't done it at start, but if it sounds like a better approach, I'll do that 👍
I think I would prefer something like Thinking a bit more about that, this also means we can retrieve one or the other after the Thanks for the suggestion, I'll update that 😃 |
6ef0776 to
afa8b53
Compare
|
Hey, looks nice! 👀 |
726a34f to
8472abd
Compare
|
I pushed a new version:
|
A new function `combinedOutput` is available, in addition to `stdout`
and `stderr`. It means you can pick the one you want depending on the context.
For instance to pick the combined output if the command failed.
$ dagger -q <<EOF
container | from alpine |
with-new-file /test.sh "echo out; echo err >&2" |
with-exec -- sh /test.sh |
combined-output
EOF
out
err
Warning: as always while working with streams, order in the output is not guaranteed.
fixes dagger#3496
Signed-off-by: Yves Brissaud <[email protected]>
8472abd to
55e9c4a
Compare
Allow to get a combined output of both standard output and standard error at once.
A new function
combinedOutputis available, in addition tostdoutandstderr. It means you can pick the one you want depending on the context. For instance to pick the combined output if the command failed.Warning
As always while working with streams, order in the output is not guaranteed.
fixes #3496