Fix handling of newline characters in command-prompt output