bacalhau
bacalhau copied to clipboard
Separate cmd output to return job-id to stdout, and helper text to stderr
Currently
❯ bacalhau docker run ubuntu echo hello world
Job ID: 50422f95-ac90-4b1c-9ba6-39afb809ec53
To get the status of the job, run:
bacalhau describe 50422f95-ac90-4b1c-9ba6-39afb809ec53
Needed
❯ bacalhau docker run ubuntu echo hello world
50422f95-ac90-4b1c-9ba6-39afb809ec53 # stdout
# stderr
To get the status of the job, run: # stderr
bacalhau describe 50422f95-ac90-4b1c-9ba6-39afb809ec53 # stderr
This applies to:
-
docker run
- probably
create
- what else?
Thread https://filecoinproject.slack.com/archives/C02RLM3JHUY/p1664961242037189
Ftw I don’t agree with this - stderr should only be used when it’s an error?
Outputting errors on stderr isn't a consistent thing, for example the output of HashiCorp's Vault CLI goes to stderr (e.g. see vault --help 2>/dev/null
) where as Terraform goes to stdout. I remember running into this issue when doing some PowerShell on Windows a few years ago as PowerShell assumes that any tool which outputs to stderr must have failed rather than looking at the exit code.
Another example of a tool which mixes stdout & stderr is curl
, which outputs the statistics to stderr so allowing users to safely redirect the output straight to a file.
One problem with mixing stdout & stderr would potentially be having the two outputs interleaved on the user's terminal
yeah, conventionally stderr is used for user facing status / info messages as well as error messages
consult the exit code for whether or not there was an error
fixed in https://github.com/filecoin-project/bacalhau/commit/7fc27cf1527cbfc6a86d469b0eda6c97a42f89f4
reverted, reopening pending discussion with @aronchick tomorrow