瀏覽代碼

Use childutils APIs.

Chris McDonough 17 年之前
父節點
當前提交
04a5bd0755
共有 2 個文件被更改,包括 3 次插入5 次删除
  1. 1 3
      src/supervisor/scripts/loop_eventgen.py
  2. 2 2
      src/supervisor/scripts/loop_listener.py

+ 1 - 3
src/supervisor/scripts/loop_eventgen.py

@@ -27,9 +27,7 @@ def main(max):
     report = open('/tmp/report', 'w')
     i = 0
     while 1:
-        childutils.write_stdout('<!--XSUPERVISOR:BEGIN-->')
-        childutils.write_stdout('the data')
-        childutils.write_stdout('<!--XSUPERVISOR:END-->')
+        childutils.send_proc_comm_stdout('the_data')
         data = sys.stdin.readline()
         report.write(str(i) + ' @ %s\n' % childutils.get_asctime())
         report.flush()

+ 2 - 2
src/supervisor/scripts/loop_listener.py

@@ -25,7 +25,7 @@ from supervisor import childutils
 def main():
     rpcinterface = childutils.getRPCInterface(os.environ)
     while 1:
-        childutils.write_stdout('READY\n')
+        childutils.protocol.ready()
         line = sys.stdin.readline()
         headers = childutils.get_headers(line)
         payload = sys.stdin.read(int(headers['len']))
@@ -34,7 +34,7 @@ def main():
             pheaders = childutils.get_headers(pheaderinfo)
             pname = '%s:%s' % (pheaders['processname'], pheaders['groupname'])
             rpcinterface.supervisor.sendProcessStdin(pname, 'Got it yo\n')
-        childutils.write_stdout('OK\n')
+        childutils.protocol.ok()
 
 if __name__ == '__main__':
     main()