aboutsummaryrefslogtreecommitdiff
path: root/input_fail.py
diff options
context:
space:
mode:
authorJoe Richey joerichey@google.com <joerichey@google.com>2017-07-17 22:51:23 -0700
committerJoe Richey joerichey@google.com <joerichey@google.com>2017-07-17 22:56:45 -0700
commit533e16c1a40aa41212d0a23e4ab0f7ca2f560a22 (patch)
treeb64a040c66c45fe8a08c2407cec1874390702bd3 /input_fail.py
parent3d08d9f6891db3ca94337e9b987ef62cba535fe1 (diff)
Makefile: Rewrite for presubmit checks
The commit reorganizes the Makefile, so that "make check" can run on each PR to detect any errors.
Diffstat (limited to 'input_fail.py')
-rwxr-xr-xinput_fail.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/input_fail.py b/input_fail.py
new file mode 100755
index 0000000..67f5e74
--- /dev/null
+++ b/input_fail.py
@@ -0,0 +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, print the argument.
+
+import sys
+
+input_string = sys.stdin.read()
+if input_string != "":
+ if len(sys.argv) >= 2:
+ print(sys.argv[1])
+ else:
+ sys.stdout.write(input_string)
+ sys.exit(1)