Don't write to stdout if the data is going to stdout

Fixes shntool integration.