eventman/data/triggers-available/echo.py

21 lines
442 B
Python
Raw Normal View History

2017-04-15 17:54:07 +02:00
#!/usr/bin/env python3
2015-04-18 15:02:20 +02:00
"""echo.py - Simply echo the environment and the stdin."""
import os
import sys
import json
def main():
2015-04-25 15:47:40 +02:00
# NOTE: even if not used, ALWAYS consume sys.stdin to close the pipe.
2017-04-15 17:54:07 +02:00
print('STDIN JSON: %s' % repr(json.loads(sys.stdin.read())))
print('')
print('ENV: %s' % repr(os.environ))
2015-04-18 15:02:20 +02:00
if __name__ == '__main__':
try:
main()
2017-04-15 17:54:07 +02:00
except Exception as e:
print('echo.py error: %s' % e)
2015-04-19 23:27:39 +02:00