mathiasvr / command-output

GitHub action that runs a command and store its output
MIT License
42 stars 10 forks source link

An output that contains stdout and stderr (in order) #3

Closed sgielen closed 2 years ago

sgielen commented 2 years ago

If a command outputs something like:

(stdout) Running test: foo
(stderr) test failed
(stdout) Running test: bar

The outputs are:

stdout

Running test: foo
Running test: bar

stderr

test failed

And you wouldn't know which test failed. Would it be possible to have a second output output that contains both stdout and stderr, in the correct order?

Thanks!

mathiasvr commented 2 years ago

You can redirect stderr to stdout by adding 2>&1 to the command.

sgielen commented 2 years ago

That requires changing the original step, though, which may be a longer run script.

Although I suppose you could just add an exec 2>&1 at the top, so now that I think about it, it isn't as bad as I thought. I'll go with that :-)

Thanks for taking the time to get back to me!