When STDIN is tty, get a single line from it and chomp it. If not, read all the lines from STDIN.