Don't rely on isTTY for stdin/stdout

This fixes #451.