Only run ps -ww -p $PID -o command= if available
This commit is contained in:
parent
7b41752775
commit
249bc245b9
@ -161,11 +161,16 @@ class ExceptionFormatter(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if cmdline is None and os.name == 'posix':
|
if cmdline is None and os.name == 'posix':
|
||||||
from subprocess import CalledProcessError, check_output as spawn
|
from shutil import which
|
||||||
|
|
||||||
try:
|
if which('ps'):
|
||||||
cmdline = spawn(['ps', '-ww', '-p', str(os.getpid()), '-o', 'command='])
|
from subprocess import CalledProcessError, check_output as spawn
|
||||||
except CalledProcessError:
|
|
||||||
|
try:
|
||||||
|
cmdline = spawn(['ps', '-ww', '-p', str(os.getpid()), '-o', 'command='])
|
||||||
|
except CalledProcessError:
|
||||||
|
return ''
|
||||||
|
else:
|
||||||
return ''
|
return ''
|
||||||
else:
|
else:
|
||||||
# current system doesn't have a way to get the command line
|
# current system doesn't have a way to get the command line
|
||||||
|
Loading…
Reference in New Issue
Block a user