Open esc opened 8 years ago
You could redirect the two streams to separate files and cat them/check the output separately. Would that work for what you're trying to do?
E.g:
$ command 2> stderr.log > stdout.log
$ cat stderr.log
Error message!
$ cat stdout.log
Regular output!
I'm trying to think of how this could be supported directly in the test syntax, but I'm not sure if it's possible. Right now when Cram invokes the shell, it redirects stderr to stdout. This makes it possible for the two output streams to be properly mixed together and checked in the tests. If Cram didn't do that redirection, I'm not sure it'd be possible to interleave the two output streams properly after the fact.
Maybe an alternative syntax could be used, with a special symbol, e.g. |
:
$ command
Regular output!
|Error message!
I am guessing here, but the separation and redirection could work, although it is somewhat cumbersome.
Is is possible to differentiate between stdout and stderr? For example to check that an error message was printed to stderr instead of stdout?
cc @snordhausen