def command_background_start(self, cmd):
"""Run a background command: run it in a new thread and resume execution immediately."""
self.printer.debug('[LOCAL CMD] Local Background Command: %s' % cmd)
def daemon(cmd):
"""Daemon used to run the command so to avoid blocking the UI"""
# Run command
master, slave = pty.openpty()
proc = subprocess.Popen(cmd, shell=True, stdout=slave, stderr=slave, close_fds=True)
stdout = os.fdopen(master)
self.printer.info("Monitoring in background...Kill this process when you want to see the dumped content")
# Run command in a thread
d = threading.Thread(name='daemon', target=daemon, args=(cmd,))
d.setDaemon(True)
d.start()
time.sleep(2)
评论列表
文章目录