~xubuntu-dev/ubiquity/lp1437180_feh

« back to all changes in this revision

Viewing changes to bin/ubiquity-wrapper

  • Committer: Colin Watson
  • Date: 2012-05-03 12:26:22 UTC
  • Revision ID: cjwatson@canonical.com-20120503122622-1pqng262csumnswx
As a general rule, open subprocesses with universal_newlines=True when
expecting to read text from them.  This has no effect on Python 2
(aside from \r\n conversion and the like, which is mostly a no-op for
us), but causes Python 3 to read str rather than bytes.  The
exceptions at the moment are debconf-communicator subprocesses, where
debconf expects to read binary data and deal with encoding itself, and
debconf-copydb subprocesses, which return mixed-encoding data that
needs to be handled specially.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
    # Apparently killing a few processes up-front helps.
119
119
    try:
120
120
        lowmem = False
121
 
        archdetect = subprocess.Popen(['archdetect'], stdout=subprocess.PIPE)
 
121
        archdetect = subprocess.Popen(
 
122
            ['archdetect'], stdout=subprocess.PIPE, universal_newlines=True)
122
123
        arch = archdetect.communicate()[0].strip()
123
124
        if arch == 'powerpc/ps3':
124
125
            with open('/proc/meminfo') as meminfo: