aboutsummaryrefslogtreecommitdiff
path: root/input_fail.py
diff options
context:
space:
mode:
authorJoseph Richey <joerichey@google.com>2017-10-03 15:33:23 -0700
committerGitHub <noreply@github.com>2017-10-03 15:33:23 -0700
commit18e2de753e2bcad172f066dc6ec78899940930ca (patch)
tree8008a68049eabac5982d881b6c1b41f5ad036459 /input_fail.py
parenta53b68fb7bf3b0cf6bbdd837d293b7a285bbb904 (diff)
parent02714459eb590d4efe6e89180dbbb9dd42b6d850 (diff)
Merge pull request #69 from google/makefilev0.2.20.2.2
Makefile cleanup
Diffstat (limited to 'input_fail.py')
-rwxr-xr-xinput_fail.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/input_fail.py b/input_fail.py
index 4b7e802..7bf33c3 100755
--- a/input_fail.py
+++ b/input_fail.py
@@ -1,13 +1,14 @@
#!/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, also print the argument.
+# argument is specified. In that case, print the argument instead.
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)