~ubuntu-branches/ubuntu/trusty/gdebi/trusty

« back to all changes in this revision

Viewing changes to GDebi/GDebiGtk.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2014-04-07 10:12:02 UTC
  • mfrom: (34.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20140407101202-3xpsopsjw3xtx1p3
Tags: 0.9.5.3
convert only full lines from dpkg-statusfd into utf8 (LP: #1301857)

Show diffs side-by-side

added added

removed removed

Lines of Context:
930
930
                )
931
931
            #print "fork_command_full: ", res, pid
932
932
 
933
 
            read = ""
 
933
            raw_read = b""
934
934
            while lock.locked():
935
935
                while True:
936
936
                    try:
937
 
                        read += os.read(readfd,1).decode("utf-8")
 
937
                        raw_read += os.read(readfd,1)
938
938
                    except OSError as e:
939
939
                        # resource temporarly unavailable is ignored
940
940
                        from errno import EAGAIN
942
942
                            logging.warn(e.errstr)
943
943
                        break
944
944
                    self.time_last_update = time.time()
945
 
                    if read.endswith("\n"):
 
945
                    if raw_read[-1] == ord("\n"):
 
946
                        read = raw_read.decode("utf-8")
946
947
                        statusl = read.split(":")
947
948
                        if len(statusl) < 3:
948
949
                            logging.warn("got garbage from dpkg: '%s'" % read)
949
 
                            read = ""
 
950
                            raw_read = ""
950
951
                            break
951
952
                        status = statusl[2].strip()
952
953
                        #print status
953
954
                        if status == "error" or status == "conffile-prompt":
954
955
                            self.term_expander.set_expanded(True)
955
 
                        read = ""
 
956
                        raw_read = b""
956
957
                self.progress.pulse()
957
958
                while Gtk.events_pending():
958
959
                    Gtk.main_iteration()