From 533e16c1a40aa41212d0a23e4ab0f7ca2f560a22 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Mon, 17 Jul 2017 22:51:23 -0700 Subject: Makefile: Rewrite for presubmit checks The commit reorganizes the Makefile, so that "make check" can run on each PR to detect any errors. --- input_fail.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 input_fail.py (limited to 'input_fail.py') 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) -- cgit v1.3 From 907eb3af7712c0fcc318006d5e48a759641d38e3 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Mon, 17 Jul 2017 23:25:48 -0700 Subject: Better output for input_fail.py --- input_fail.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'input_fail.py') 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) -- cgit v1.3