-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat: add command output/error option #223
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect stdout is not enough. My concern is that stderr would not end up in the (empty) file, but would go to terminal:
$ ipfs id --command-output=stdout.txt
Error: no IPFS repo found in /home/lidel/tmp/go-ipfs-out.
please run: 'ipfs init'
$ ipfs get invalidcid --command-output=stdout.txt
Error: invalid path "invalidcid": selected encoding not supported
If someone runs a command in bash script, they may not monitor stderr and the message may be lost.
Perhaps an elegant way of handling this is to have explicit --stdout
(or --output
) and --stderr
(or --errors
) ?
$ ipfs get invalidcid --stdout=stdout.txt --stderr=stderr.txt
$ cat stdout.txt
$ cat stderr.txt
Error: invalid path "invalidcid": selected encoding not supported
cc @aschmahmann you may have better intuition about what would be the most useful on windows
@lidel Added error output option (we can review the option names at the end; I'm leaving for now the conspicuous |
Co-authored-by: Marcin Rataj <[email protected]>
Add an option to save command output to a file instead of the
stdout
argument (which was always set to stdout bygo-ipfs
consumer). We have removed the option and assumed stdout except the option is set (this was intended to loudly flag the output is being set by an option since the argument could be misleadingly overridden, but we can restore the argument and have the two coexist).Used in ipfs/kubo#8683.
Related to ipfs/kubo#8335.