| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 KillWindows(pid) | 165 KillWindows(pid) |
| 166 else: | 166 else: |
| 167 KillPosix(pid) | 167 KillPosix(pid) |
| 168 print("Killed pid: %s" % pid) | 168 print("Killed pid: %s" % pid) |
| 169 if len(pids) == 0: | 169 if len(pids) == 0: |
| 170 print(" No %s processes found." % name) | 170 print(" No %s processes found." % name) |
| 171 return len(pids) | 171 return len(pids) |
| 172 | 172 |
| 173 def KillBrowsers(): | 173 def KillBrowsers(): |
| 174 status = Kill('firefox') | 174 status = Kill('firefox') |
| 175 status += Kill('chrome') | 175 # We don't give error on killing chrome. It happens quite often that the |
| 176 # browser controller fails in killing chrome, so we silently do it here. |
| 177 Kill('chrome') |
| 176 status += Kill('iexplore') | 178 status += Kill('iexplore') |
| 177 status += Kill('safari') | 179 status += Kill('safari') |
| 178 status += Kill('content_shell') | 180 status += Kill('content_shell') |
| 179 return status | 181 return status |
| 180 | 182 |
| 181 def KillVCSystems(): | 183 def KillVCSystems(): |
| 182 status = Kill('git') | 184 status = Kill('git') |
| 183 status += Kill('svn') | 185 status += Kill('svn') |
| 184 return status | 186 return status |
| 185 | 187 |
| 186 def KillDart(): | 188 def KillDart(): |
| 187 status = Kill("dart") | 189 status = Kill("dart") |
| 188 return status | 190 return status |
| 189 | 191 |
| 190 def Main(): | 192 def Main(): |
| 191 options = GetOptions() | 193 options = GetOptions() |
| 192 status = 0 | 194 status = 0 |
| 193 if options.kill_dart: | 195 if options.kill_dart: |
| 194 status += KillDart() | 196 status += KillDart() |
| 195 if options.kill_vc: | 197 if options.kill_vc: |
| 196 status += KillVCSystems() | 198 status += KillVCSystems() |
| 197 if options.kill_browsers: | 199 if options.kill_browsers: |
| 198 status += KillBrowsers() | 200 status += KillBrowsers() |
| 199 return status | 201 return status |
| 200 | 202 |
| 201 if __name__ == '__main__': | 203 if __name__ == '__main__': |
| 202 sys.exit(Main()) | 204 sys.exit(Main()) |
| OLD | NEW |