getting properly one subprocess output
jeanmichel at sequans.com
Wed Nov 18 12:25:14 CET 2009
Hi python fellows,
I'm currently inspecting my Linux process list, trying to parse it in
order to get one particular process (and kill it).
I ran into an annoying issue:
The stdout display is somehow truncated (maybe a terminal length issue,
I don't know), breaking my parsing.
commandLine = ['ps', '-eo "%p %U %P %y %t %C %c %a"']
process = subprocess.Popen(commandLine, stdout=subprocess.PIPE,
processList, stderrdata = process.communicate()
Here is a sample of what I get in processList.split('\n'):
' "25487 1122 4344 ? 7-17:48:32 2.5 firefox-bin
' "25492 1122 4892 pts/6 00:08 57.2 ipython
As you can see, to complete process command line is truncated.
Any clue on how to get the full version ?
More information about the Python-list