I agree with what @rsmith says, although I think this statement is a bit too strong:
There’s plenty of perfectly legitimate and widely-used Unix commands that send diagnostic / user feedback to stdout
- but they’re just not designed to be used as part of larger pipelines (e.g. cp -v
, tar
, rsync
). But as soon as you want to allow piped operations, then it becomes essential to keep stdout
clean of any diagnostic feedback so that the data passed to subsequent commands is bona fide output and nothing else. Unfortunately, that means they need to use stderr
for both regular user feedback and actual warnings/errors, and this is what MRtrix3 commands do - an issue already raised a while back.
@rsmith: would it be possible within the current run.command()
call to output stdout
for the last command on the stack…? This would more or less mirror the output you’d see on the command line, and basically fix this issue. The one thing it won’t do is preserve the order for mixed stdout
& stderr
output - but that’s fragile anyway, given that stdout
is buffered (by default), whereas stderr
is not…