Check stdout stderr before using bold text

Only use bold escape sequences in the output when we write to a
terminal, not otherwise.