Chromium Code Reviews| Index: chrome/test/mini_installer/uninstall_chrome.py |
| diff --git a/chrome/test/mini_installer/uninstall_chrome.py b/chrome/test/mini_installer/uninstall_chrome.py |
| index f501856737d1b6eee8869193cbe9d83e7013d2c4..d8e96910fa8b10adac9612c2eae4074c011cac1b 100644 |
| --- a/chrome/test/mini_installer/uninstall_chrome.py |
| +++ b/chrome/test/mini_installer/uninstall_chrome.py |
| @@ -20,6 +20,12 @@ def main(): |
| default=False, help='Uninstall Chrome at system level.') |
| parser.add_option('--chrome-long-name', default='Google Chrome', |
| help='Google Chrome or Chromium)') |
| + parser.add_option('--interactive', action='store_true', dest='interactive', |
| + default=False, help='Ask before uninstalling Chrome') |
|
gab
2013/09/16 13:59:58
Add '.' at the end of help string.
sukolsak
2013/09/16 18:19:22
Done.
|
| + parser.add_option('--no-error-if-absent', action='store_true', |
| + dest='no_error_if_absent', default=False, |
| + help='No error if the registry key for uninstalling Chrome ' |
| + 'is absent') |
|
gab
2013/09/16 13:59:58
Add '.' at the end of help string.
sukolsak
2013/09/16 18:19:22
Done.
|
| options, _ = parser.parse_args() |
| # TODO(sukolsak): Add support for uninstalling MSI-based Chrome installs when |
| @@ -34,9 +40,17 @@ def main(): |
| try: |
| key = _winreg.OpenKey(root_key, sub_key, 0, _winreg.KEY_QUERY_VALUE) |
| except WindowsError: |
| + if options.no_error_if_absent: |
| + return 0 |
| raise KeyError('Registry key %s\\%s is missing' % ( |
| 'HKEY_LOCAL_MACHINE' if options.system_level else 'HKEY_CURRENT_USER', |
| sub_key)) |
| + if options.interactive: |
| + prompt = ('Warning: This will uninstall %s. Do you want to continue? (y/N) ' |
|
gab
2013/09/16 13:59:58
s/This will uninstall %s/This will uninstall %s at
sukolsak
2013/09/16 18:19:22
Done.
|
| + % options.chrome_long_name) |
| + if raw_input(prompt).strip() != 'y': |
| + print >> sys.stderr, 'User aborted' |
| + return 1 |
| uninstall_string, _ = _winreg.QueryValueEx(key, 'UninstallString') |
| exit_status = subprocess.call(uninstall_string + ' --force-uninstall', |
| shell=True) |