OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Uninstalls Chrome. | 5 """Uninstalls Chrome. |
6 | 6 |
7 This script reads the uninstall command from registry, calls it, and verifies | 7 This script reads the uninstall command from registry, calls it, and verifies |
8 the output status code. | 8 the output status code. |
9 """ | 9 """ |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 sub_key = ('SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s' % | 31 sub_key = ('SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s' % |
32 options.chrome_long_name) | 32 options.chrome_long_name) |
33 # Query the key. It will throw a WindowsError if the key doesn't exist. | 33 # Query the key. It will throw a WindowsError if the key doesn't exist. |
34 try: | 34 try: |
35 key = _winreg.OpenKey(root_key, sub_key, 0, _winreg.KEY_QUERY_VALUE) | 35 key = _winreg.OpenKey(root_key, sub_key, 0, _winreg.KEY_QUERY_VALUE) |
36 except WindowsError: | 36 except WindowsError: |
37 raise KeyError('Registry key %s\\%s is missing' % ( | 37 raise KeyError('Registry key %s\\%s is missing' % ( |
38 'HKEY_LOCAL_MACHINE' if options.system_level else 'HKEY_CURRENT_USER', | 38 'HKEY_LOCAL_MACHINE' if options.system_level else 'HKEY_CURRENT_USER', |
39 sub_key)) | 39 sub_key)) |
40 uninstall_string, _ = _winreg.QueryValueEx(key, 'UninstallString') | 40 uninstall_string, _ = _winreg.QueryValueEx(key, 'UninstallString') |
41 exit_status = subprocess.call(uninstall_string, shell=True) | 41 exit_status = subprocess.call(uninstall_string + ' --force-uninstall', |
| 42 shell=True) |
42 # The exit status for successful uninstallation of Chrome is 19 (see | 43 # The exit status for successful uninstallation of Chrome is 19 (see |
43 # chrome/installer/util/util_constants.h). | 44 # chrome/installer/util/util_constants.h). |
44 if exit_status != 19: | 45 if exit_status != 19: |
45 raise Exception('Could not uninstall Chrome. The installer exited with ' | 46 raise Exception('Could not uninstall Chrome. The installer exited with ' |
46 'status %d.' % exit_status) | 47 'status %d.' % exit_status) |
47 return 0 | 48 return 0 |
48 | 49 |
49 | 50 |
50 if __name__ == '__main__': | 51 if __name__ == '__main__': |
51 sys.exit(main()) | 52 sys.exit(main()) |
OLD | NEW |