Chromium Code Reviews| Index: chrome/test/mini_installer/quit_chrome.py |
| diff --git a/chrome/test/mini_installer/quit_chrome.py b/chrome/test/mini_installer/quit_chrome.py |
| index 716ff23931fa3e467f4a7c99fde468569ca9bc40..5dc15ca9b9ff47da8ed4a5194de694409c69c927 100644 |
| --- a/chrome/test/mini_installer/quit_chrome.py |
| +++ b/chrome/test/mini_installer/quit_chrome.py |
| @@ -9,10 +9,12 @@ the process terminates. |
| """ |
| import optparse |
| +import pywintypes |
| import sys |
| import time |
| import win32con |
| import win32gui |
| +import winerror |
| import chrome_helper |
| @@ -34,7 +36,14 @@ def CloseWindows(process_path): |
| return True |
| for hwnd in chrome_helper.GetWindowHandles(process_ids): |
| - win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0) |
| + try: |
| + win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0) |
| + except pywintypes.error as error: |
| + if error.args[0] == winerror.ERROR_INVALID_WINDOW_HANDLE: |
| + # It's normal that some window handles have become invalid. |
| + pass |
|
grt (UTC plus 2)
2013/09/09 18:53:59
is this more idomatic than:
# It's normal that s
gab
2013/09/09 19:29:06
+1 (had to lookup "idomatic", but yes I prefer tha
sukolsak
2013/09/09 21:26:41
Done.
|
| + else: |
| + raise |
| time.sleep(0) |
| return False |