Well, that was silly of me... forgot to fix my fix for the fix :S . Here's what I meant to post:
# Check if the process with pid is running
def pid_running(pid):
if os.path.isdir('/proc/' + str(pid)):
with open('/proc/' + str(pid) + '/comm') as fd: cmd = fd.read() return cmd.strip() == 'cameramonitor'
else:
return False
I also added conversion of "pid" to a string, in case it is ever passed as an integer. Testing this on the interactive prompt worked fine for me.
Well, that was silly of me... forgot to fix my fix for the fix :S . Here's what I meant to post:
# Check if the process with pid is running isdir(' /proc/' + str(pid)):
cmd = fd.read()
return cmd.strip() == 'cameramonitor'
def pid_running(pid):
if os.path.
with open('/proc/' + str(pid) + '/comm') as fd:
else:
return False
I also added conversion of "pid" to a string, in case it is ever passed as an integer. Testing this on the interactive prompt worked fine for me.