aboutsummaryrefslogtreecommitdiff
path: root/input_fail.py
diff options
context:
space:
mode:
authorJoe Richey joerichey@google.com <joerichey@google.com>2017-07-17 23:25:48 -0700
committerJoe Richey joerichey@google.com <joerichey@google.com>2017-07-17 23:25:48 -0700
commit907eb3af7712c0fcc318006d5e48a759641d38e3 (patch)
tree788bb164cbad95be76235940093526477a744daa /input_fail.py
parente4cb9c6cef2d75cdc5ca62777d2fa0e44f813fd4 (diff)
Better output for input_fail.py
Diffstat (limited to 'input_fail.py')
-rwxr-xr-xinput_fail.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/input_fail.py b/input_fail.py
index 67f5e74..4b7e802 100755
--- a/input_fail.py
+++ b/input_fail.py
@@ -1,14 +1,13 @@
#!/usr/bin/env python
# Exit with 1 if any input is provided. Print the input to stdout, unless an
-# argument is specified. In that case, print the argument.
+# argument is specified. In that case, also print the argument.
import sys
input_string = sys.stdin.read()
if input_string != "":
+ sys.stdout.write(input_string)
if len(sys.argv) >= 2:
print(sys.argv[1])
- else:
- sys.stdout.write(input_string)
sys.exit(1)