test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
RecoLuminosity
LumiDB
python
sysUtil.py
Go to the documentation of this file.
1
import
os,sys,os.path,shlex
2
from
subprocess
import
Popen,PIPE,STDOUT
3
from
cStringIO
import
StringIO
4
5
def
runCmmd
(cmmdline,shell=False):
6
"""runsubprocess return processid
7
"""
8
args=[]
9
proc=Popen(cmmdline,shell=shell,stdout=PIPE,stdin=PIPE,stderr=STDOUT)
10
stdout_value,stderr_value=proc.communicate()
11
print
repr(stdout_value)
12
return
proc.pid
13
14
def
processRunning
(processid):
15
"""
16
check if a process is still running
17
"""
18
return
os.path.exists(os.path.join(
'/proc'
,str(processid)))
19
20
if
__name__==
'__main__'
:
21
print
processRunning
(13378)
22
pid=
runCmmd
(
'cat -; echo ";to stderr" 1>&2'
,shell=
True
)
23
print
processRunning
(pid)
sysUtil.processRunning
def processRunning
Definition:
sysUtil.py:14
sysUtil.runCmmd
def runCmmd
Definition:
sysUtil.py:5
Generated for CMSSW Reference Manual by
1.8.5