Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Side by Side Diff: third_party/psutil/examples/killall.py

Issue 8159001: Update third_party/psutil and fix the licence issue with it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove the suppression and unnecessary files. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/psutil/examples/iotop.py ('k') | third_party/psutil/examples/process_detail.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # $Id: killall.py 1143 2011-10-05 19:11:59Z g.rodola $
4 #
5 # Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
6 # Use of this source code is governed by a BSD-style license that can be
7 # found in the LICENSE file.
8
9 """
10 Kill a process by name.
11 """
12
13 import os
14 import sys
15 import psutil
16
17 def main():
18 if len(sys.argv) != 2:
19 sys.exit('usage: %s name' % __file__)
20 else:
21 NAME = sys.argv[1]
22
23 killed = []
24 for proc in psutil.process_iter():
25 if proc.name == NAME and proc.pid != os.getpid():
26 proc.kill()
27 killed.append(proc.pid)
28 if not killed:
29 sys.exit('%s: no process found' % NAME)
30 else:
31 sys.exit(0)
32
33 sys.exit(main())
OLDNEW
« no previous file with comments | « third_party/psutil/examples/iotop.py ('k') | third_party/psutil/examples/process_detail.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698