def response(self): '''Return the response from the launched process. Return None if no response was received yet from a background process. ''' if self._stdout is None: raise LauncherException("'launch' is required after any reconfiguration") if self._response is not None: return self._response # when running in foreground _pid is 0 (may change to -1) if self._pid <= 0: self._response = self._stdout.read() return self._response # handle response from a background process def onData(selector, fobj): if self.verbose: print("in Launcher.response.onData") self._debug.log('on_remote') self._response = fobj.read() selector.state = False return def onTimeout(selector): selector.state = False sel = Selector() #sel._info.activate() sel.notifyOnReadReady(self._stdout, onData) sel.notifyWhenIdle(onTimeout) sel.watch(2.0) # reset _response to None to allow capture of a next response # from a background process return self._response
def response(self): '''Return the response from a remotely launched process. Return None if there was no response yet from a background process. ''' if self._response is not None: return self._response # when running in foreground _pid is 0 (may change to -1) if self._pid <= 0: self._response = self._fromchild.read() return self._response # handle response from a background process def onData(selector, fobj): print "in LauncherSCP.response.onData" self._debug.log('on_remote') self._response = fobj.read() selector.state = False return def onTimeout(selector): selector.state = False sel = Selector() #sel._info.activate() sel.notifyOnReadReady(self._fromchild, onData) sel.notifyWhenIdle(onTimeout) sel.watch(2.0) # reset _response to None to allow capture of a next response # from a background process return self._response
def response(self): '''Return the response from the launched process. Return None if no response was received yet from a background process. ''' if self._stdout is None: raise LauncherException( "'launch' is required after any reconfiguration") if self._response is not None: return self._response # when running in foreground _pid is 0 (may change to -1) if self._pid <= 0: self._response = self._stdout.read() return self._response # handle response from a background process def onData(selector, fobj): if self.verbose: print("in Launcher.response.onData") self._debug.log('on_remote') self._response = fobj.read() selector.state = False return def onTimeout(selector): selector.state = False sel = Selector() #sel._info.activate() sel.notifyOnReadReady(self._stdout, onData) sel.notifyWhenIdle(onTimeout) sel.watch(2.0) # reset _response to None to allow capture of a next response # from a background process return self._response
def response(self): '''read the response from remotely launched process''' self._response = '' def onData(selector, fobj): self._debug.log('on_remote') self._response = fobj.readline() selector.state = False return def onTimeout(selector): selector.state = False sel = Selector() #sel._info.activate() sel.notifyOnReadReady(self._fromchild, onData) sel.notifyWhenIdle(onTimeout) sel.watch(2.0) return self._response