eventman/data/triggers-available/echo.py

21 lines
427 B
Python
Raw Normal View History

2015-04-18 15:02:20 +02:00
#!/usr/bin/env python
"""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.
print 'STDIN JSON:', repr(json.loads(sys.stdin.read()))
2015-04-18 15:02:20 +02:00
print ''
2015-04-25 15:47:40 +02:00
print 'ENV:', repr(os.environ)
2015-04-18 15:02:20 +02:00
if __name__ == '__main__':
try:
main()
except Exception, e:
print 'echo.py error: %s' % e
2015-04-19 23:27:39 +02:00