1 | #!/usr/bin/env python2
|
2 | from __future__ import print_function
|
3 | """
|
4 | stdout_stderr.py
|
5 |
|
6 | Tool for testing redirects.
|
7 | """
|
8 |
|
9 | import sys
|
10 |
|
11 |
|
12 | def main(argv):
|
13 | try:
|
14 | stdout = argv[1]
|
15 | except IndexError:
|
16 | stdout = 'STDOUT'
|
17 |
|
18 | try:
|
19 | stderr = argv[2]
|
20 | except IndexError:
|
21 | stderr = 'STDERR'
|
22 |
|
23 | try:
|
24 | status = int(argv[3])
|
25 | except IndexError:
|
26 | status = 0
|
27 |
|
28 | print(stdout)
|
29 | print(stderr, file=sys.stderr)
|
30 | return status
|
31 |
|
32 |
|
33 | if __name__ == '__main__':
|
34 | sys.exit(main(sys.argv))
|