Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def onChild(pid, fromparent, toparent):
toparent.write(_b('hello dad\n'))
toparent.flush()
s = _str(fromparent.readline())
print(s, end='')
os._exit(0)
def onParent(pid, fromchild, tochild):
s = _str(fromchild.readline())
print(s, end='')
tochild.write(_b('hello son\n'))
tochild.flush()
os.wait()
def onChild(pid, fromparent, toparent):
try:
response = self._server._marshaled_dispatch(data)
self._sendResponse(response)
line = _str(fromparent.readline())
toparent.write(_b('done\n'))
toparent.flush()
except:
logger(name='pathos.xmlrpc', level=30).error(print_exc_info())
os._exit(0)
def _sendResponse(self, response):
""" Write the XML-RPC response """
response = _b(response)
self.send_response(200)
self.send_header("Content-type", "text/xml")
self.send_header("Content-length", str(len(response)))
self.end_headers()
self.wfile.write(response)
self.wfile.flush()
self.connection.shutdown(1)
def onParent(pid, fromchild, tochild):
self._server._registerChild(pid, fromchild)
tochild.write(_b('done\n'))
tochild.flush()
response = dispatch_method(method, params)
else:
response = self._dispatch(method, params)
# wrap response in a singleton tuple
response = (response,)
response = client.dumps(response, methodresponse=1)
except Fault as fault: # breaks 2.5 compatibility
fault.faultString = print_exc_info()
response = client.dumps(fault)
except:
# report exception back to server
response = client.dumps(
client.Fault(1, "\n%s" % print_exc_info())
)
return _b(response)