aboutsummaryrefslogtreecommitdiff
path: root/input_fail.py
blob: 67f5e74981a53383a90e5a4a1b94c8846e14be07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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)