diff options
author | necoro <> | 2007-08-17 03:54:39 +0000 |
---|---|---|
committer | necoro <> | 2007-08-17 03:54:39 +0000 |
commit | a82504f1627ba80641ad4c3ea8721a2701c364a7 (patch) | |
tree | c41e4a07950c732af6090ea3f55e88fc49e055a1 /portato/gui/gui_helper.py | |
parent | ae63d36e760b749b97332915b8a91dd6f9ece199 (diff) | |
download | portato-a82504f1627ba80641ad4c3ea8721a2701c364a7.tar.gz portato-a82504f1627ba80641ad4c3ea8721a2701c364a7.tar.bz2 portato-a82504f1627ba80641ad4c3ea8721a2701c364a7.zip |
improved terminal
Diffstat (limited to 'portato/gui/gui_helper.py')
-rw-r--r-- | portato/gui/gui_helper.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index 87fcf69..3ed8152 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -272,6 +272,7 @@ class EmergeQueue: # the emerge process self.process = None self.threadQueue = WaitingQueue(threadClass = threadClass) + self.pty = None # dictionaries with data about the packages in the queue self.iters = {} # iterator in the tree @@ -497,11 +498,14 @@ class EmergeQueue: command = system.get_merge_command() # open tty - (master, slave) = pty.openpty() - self.console.set_pty(master) + if not self.pty: + self.pty = pty.openpty() + self.console.set_pty(self.pty[0]) + else: + self.console.reset() # start emerge - self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False, env = system.get_environment(), preexec_fn = os.setsid) + self.process = Popen(command+options+packages, stdout = self.pty[1], stderr = STDOUT, shell = False, env = system.get_environment(), preexec_fn = os.setsid) # remove packages from queue for i in it: @@ -518,18 +522,22 @@ class EmergeQueue: if self.title_update: self.title_update(None) + if self.process is None: # someone resetted this + self.threadQueue.next() return + else: + ret = self.process.returncode + self.process = None + self.threadQueue.next() - @plugin.hook("after_emerge", packages = packages, retcode = self.process.returncode) + @plugin.hook("after_emerge", packages = packages, retcode = ret) def update_packages(): for cat in unique_array([system.split_cpv(p)[0] for p in packages if p not in ["world", "system"]]): self.db.reload(cat) debug("Category %s refreshed", cat) update_packages() - self.process = None - self.threadQueue.next() sub_emerge(command) |