diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-09-15 14:16:54 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-09-15 14:16:54 +0200 |
| commit | 92ee136013b7432b0e21694098b17f3d0a4f7be5 (patch) | |
| tree | c8081733470fb08882b48d87703394e6a58ada70 /apt/progress/__init__.py | |
| parent | 7fe83be76c6aac0778225a0106b46293d34543bf (diff) | |
| parent | 7acb16fc4baa43cf2cbbc4de948973bdc099d878 (diff) | |
| download | python-apt-92ee136013b7432b0e21694098b17f3d0a4f7be5.tar.gz | |
merge from mvo
* apt/cache.py:
- re-work the logic in commit() to fail if installArchives() returns
a unexpected result
* apt/progress/__init__.py:
- catch exceptions in pm.DoInstall()
Diffstat (limited to 'apt/progress/__init__.py')
| -rw-r--r-- | apt/progress/__init__.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 9f348ffd..8a9eb86f 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -284,7 +284,11 @@ class InstallProgress(DumbInstallProgress): return os.fork() def waitChild(self): - """Wait for child progress to exit.""" + """Wait for child progress to exit. + + The return values is the full status returned from os.waitpid() + (not only the return code). + """ while True: try: select.select([self.statusfd], [], [], self.selectTimeout) @@ -304,11 +308,22 @@ class InstallProgress(DumbInstallProgress): return res def run(self, pm): - """Start installing.""" + """Start installing. + + Returns the PackageManager status: + (pm.ResultCompleted, pm.ResultFailed, pm.ResultIncomplete) + """ pid = self.fork() if pid == 0: - # child - res = pm.DoInstall(self.writefd) + # pm.DoInstall might raise a exception, + # when this happens, we need to catch + # it, otherwise os._exit() is not run + # and the execution continues in the + # parent code leading to very confusing bugs + try: + res = pm.DoInstall(self.writefd) + except Exception, e: + os._exit(pm.ResultFailed) os._exit(res) self.child_pid = pid res = self.waitChild() |
