How to redirect output to /dev/null

I’m setting up a composite action; at some point I compile and run an application to make sure it completes its execution without throwing an error. Its output is irrelevant however (I just want to make sure that the executable returns 0). How can I redirect the output to /dev/null so that it doesn’t clutter the console/log?

In a normal Linux environment I would do ./myapp 1> /dev/null but that doesn’t seem to work with the GitHub-hosted runners.

1> redirects only stdout, if there is any stderr output you don’t want to see you’ll need to redirect that, too.

If that doesn’t help, which shell is your step using? Could you show an example of the problem?

1 Like

Thank you airtower-luna :slight_smile: I do want to see the stderr output, that’s why I only want to redirect stdout. But I just went back to check my code and you’re right, there were lines that were outputting to stderr (which I’m not redirecting).

So my bad! There’s no problem with redirection while running on a hosted runner.

Thank you again!

1 Like