OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 # | 6 # |
7 | 7 |
8 # A script to kill hanging processs. The tool will return non-zero if any | 8 # A script to kill hanging processs. The tool will return non-zero if any |
9 # process was actually found. | 9 # process was actually found. |
10 # | 10 # |
(...skipping 12 matching lines...) Expand all Loading... |
23 POSIX_INFO = 'ps -p %s -o args' | 23 POSIX_INFO = 'ps -p %s -o args' |
24 | 24 |
25 EXECUTABLE_NAMES = { | 25 EXECUTABLE_NAMES = { |
26 'win32': { | 26 'win32': { |
27 'chrome': 'chrome.exe', | 27 'chrome': 'chrome.exe', |
28 'content_shell': 'content_shell.exe', | 28 'content_shell': 'content_shell.exe', |
29 'dart': 'dart.exe', | 29 'dart': 'dart.exe', |
30 'iexplore': 'iexplore.exe', | 30 'iexplore': 'iexplore.exe', |
31 'firefox': 'firefox.exe', | 31 'firefox': 'firefox.exe', |
32 'git': 'git.exe', | 32 'git': 'git.exe', |
33 'svn': 'svn.exe' | 33 'svn': 'svn.exe', |
| 34 'fletch': 'fletch.exe', |
| 35 'fletch-vm': 'fletch-vm.exe', |
34 }, | 36 }, |
35 'linux': { | 37 'linux': { |
36 'chrome': 'chrome', | 38 'chrome': 'chrome', |
37 'content_shell': 'content_shell', | 39 'content_shell': 'content_shell', |
38 'dart': 'dart', | 40 'dart': 'dart', |
39 'firefox': 'firefox.exe', | 41 'firefox': 'firefox.exe', |
40 'git': 'git', | 42 'git': 'git', |
41 'svn': 'svn' | 43 'svn': 'svn', |
| 44 'fletch': 'fletch', |
| 45 'fletch-vm': 'fletch-vm', |
42 }, | 46 }, |
43 'macos': { | 47 'macos': { |
44 'chrome': 'Chrome', | 48 'chrome': 'Chrome', |
45 'content_shell': 'Content Shell', | 49 'content_shell': 'Content Shell', |
46 'dart': 'dart', | 50 'dart': 'dart', |
47 'firefox': 'firefox', | 51 'firefox': 'firefox', |
48 'safari': 'Safari', | 52 'safari': 'Safari', |
49 'git': 'git', | 53 'git': 'git', |
50 'svn': 'svn' | 54 'svn': 'svn', |
| 55 'fletch': 'fletch', |
| 56 'fletch-vm': 'fletch-vm', |
51 } | 57 } |
52 } | 58 } |
53 | 59 |
54 INFO_COMMAND = { | 60 INFO_COMMAND = { |
55 'win32': 'wmic process where Processid=%s get CommandLine', | 61 'win32': 'wmic process where Processid=%s get CommandLine', |
56 'macos': POSIX_INFO, | 62 'macos': POSIX_INFO, |
57 'linux': POSIX_INFO, | 63 'linux': POSIX_INFO, |
58 } | 64 } |
59 | 65 |
60 def GetOptions(): | 66 def GetOptions(): |
61 parser = optparse.OptionParser("usage: %prog [options]") | 67 parser = optparse.OptionParser("usage: %prog [options]") |
62 parser.add_option("--kill_dart", default=True, | 68 parser.add_option("--kill_dart", default=True, |
63 help="Kill all dart processes") | 69 help="Kill all dart processes") |
| 70 parser.add_option("--kill_fletch", default=True, |
| 71 help="Kill all fletch and fletch-vm processes") |
64 parser.add_option("--kill_vc", default=True, | 72 parser.add_option("--kill_vc", default=True, |
65 help="Kill all git and svn processes") | 73 help="Kill all git and svn processes") |
66 parser.add_option("--kill_browsers", default=False, | 74 parser.add_option("--kill_browsers", default=False, |
67 help="Kill all browser processes") | 75 help="Kill all browser processes") |
68 (options, args) = parser.parse_args() | 76 (options, args) = parser.parse_args() |
69 return options | 77 return options |
70 | 78 |
71 | 79 |
72 def GetPidsPosix(process_name): | 80 def GetPidsPosix(process_name): |
73 # This is to have only one posix command, on linux we could just do: | 81 # This is to have only one posix command, on linux we could just do: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 190 |
183 def KillVCSystems(): | 191 def KillVCSystems(): |
184 status = Kill('git') | 192 status = Kill('git') |
185 status += Kill('svn') | 193 status += Kill('svn') |
186 return status | 194 return status |
187 | 195 |
188 def KillDart(): | 196 def KillDart(): |
189 status = Kill("dart") | 197 status = Kill("dart") |
190 return status | 198 return status |
191 | 199 |
| 200 def KillFletch(): |
| 201 status = Kill("fletch") |
| 202 status += Kill("fletch-vm") |
| 203 return status |
| 204 |
192 def Main(): | 205 def Main(): |
193 options = GetOptions() | 206 options = GetOptions() |
194 status = 0 | 207 status = 0 |
195 if options.kill_dart: | 208 if options.kill_dart: |
196 status += KillDart() | 209 status += KillDart() |
| 210 if options.kill_fletch: |
| 211 status += KillFletch() |
197 if options.kill_vc: | 212 if options.kill_vc: |
198 status += KillVCSystems() | 213 status += KillVCSystems() |
199 if options.kill_browsers: | 214 if options.kill_browsers: |
200 status += KillBrowsers() | 215 status += KillBrowsers() |
201 return status | 216 return status |
202 | 217 |
203 if __name__ == '__main__': | 218 if __name__ == '__main__': |
204 sys.exit(Main()) | 219 sys.exit(Main()) |
OLD | NEW |