jp (shell): use of subprocess instead of running commands in the same process:
when a command is calling host.quit() in a D-Bus callback, GLib mainloop is exiting and quit the whole process without (apparently?) any way to block it. Couldn't find a good way to avoid that, so subprocess are now used as a workaround, instead of launching commands in the same process. When we'll get rid of python-dbus, there may be an other way. Execuring external commands is now possible through the shell/! command.
This commit is contained in:
parent
783d14bfc7
commit
62c17395bd
1 changed files with 47 additions and 20 deletions
|
|
@ -165,9 +165,6 @@ class Jp(object):
|
|||
|
||||
self.bridge = bridge_module.Bridge()
|
||||
self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb)
|
||||
# _no_exit is used in shell mode because SystemExit can't
|
||||
# catched in some cases
|
||||
self._no_exit = False
|
||||
|
||||
def _bridgeCb(self):
|
||||
self.parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
|
|
@ -445,8 +442,7 @@ class Jp(object):
|
|||
callback(*args, **kwargs)
|
||||
|
||||
self.stop_loop()
|
||||
if not self._no_exit:
|
||||
sys.exit(errcode)
|
||||
sys.exit(errcode)
|
||||
|
||||
def check_jids(self, jids):
|
||||
"""Check jids validity, transform roster name to corresponding jids
|
||||
|
|
|
|||
Loading…
Reference in a new issue