Added stdin support with tempfile.