-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cca97f0
commit 9b4b381
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import sys | ||
|
||
def write_stdout(s): | ||
sys.stdout.write(s) | ||
sys.stdout.flush() | ||
|
||
def write_stderr(s): | ||
sys.stderr.write(s) | ||
sys.stderr.flush() | ||
|
||
def main(): | ||
while 1: | ||
write_stdout('READY\n') # transition from ACKNOWLEDGED to READY | ||
line = sys.stdin.readline() # read header line from stdin | ||
headers = dict([ x.split(':') for x in line.split() ]) | ||
data = sys.stdin.read(int(headers['len'])) # read the event payload | ||
write_stdout('RESULT %s\n%s'%(len(data), data)) # transition from READY to ACKNOWLEDGED | ||
|
||
def event_handler(event, response): | ||
line, data = response.split('\n', 1) | ||
headers = dict([ x.split(':') for x in line.split() ]) | ||
print '%s %s | %s'%(headers['processname'], headers['channel'], data), | ||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.