~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

merge David Clymer's patch for TestCaseInTestDir.runcmd

Show diffs side-by-side

added added

removed removed

Lines of Context:
244
244
        pass a list instead."""
245
245
        cmd = self._formcmd(cmd)
246
246
        self.log('$ ' + ' '.join(cmd))
247
 
        actual_retcode = subprocess.call(cmd, stdout=self._log_file,
248
 
                                         stderr=self._log_file)
 
247
        child = subprocess.Popen(cmd, stdout=subprocess.PIPE,
 
248
                                                       stderr=subprocess.PIPE)
 
249
        outd, errd = child.communicate()
 
250
        self.log(outd)
 
251
        self.log(errd)
 
252
 
 
253
        actual_retcode = child.wait()
249
254
        if retcode != actual_retcode:
250
255
            raise CommandFailed("test failed: %r returned %d, expected %d"
251
256
                                % (cmd, actual_retcode, retcode))
252
257
 
 
258
        return outd, errd
 
259
 
253
260
    def backtick(self, cmd, retcode=0):
254
261
        """Run a command and return its output"""
255
262
        cmd = self._formcmd(cmd)