Example #1
0
 def update_interface(self):
     InstallProgress.update_interface(self)
     if self.statusfd == None:
         return
     if (self.last_activity + self.timeout) < time.time():
         logging.warning("no activity %s seconds (%s) - sending ctrl-c" % (
                 self.timeout, self.status))
         # ctrl-c
         os.write(self.master_fd,chr(3))
     # read master fd and write to stdout so that terminal output
     # actualy works
     res = select.select([self.master_fd],[],[],0.1)
     while len(res[0]) > 0:
        self.last_activity = time.time()
        try:
            s = os.read(self.master_fd, 1)
            sys.stdout.write("%s" % s)
        except OSError:
            # happens after we are finished because the fd is closed
            return
        res = select.select([self.master_fd],[],[],0.1)
     sys.stdout.flush()