Works with output to stdout.