getting properly one subprocess output

Jean-Michel Pichavant jeanmichel at sequans.com
Thu Nov 19 13:58:01 CET 2009


Nobody wrote:
> On Wed, 18 Nov 2009 12:25:14 +0100, Jean-Michel Pichavant wrote:
>
>   
>> 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.
>>     
>
>   
>> As you can see, to complete process command line is truncated.
>> Any clue on how to get the full version ?
>>     
>
> If you only need it to work on Linux, you can just enumerate 
> /proc/[1-9]*/exe or /proc/[1-9]*/cmdline.
>
> Or you can add -ww to "ps" to avoid truncating the output.
>
> Note that the /proc/*/exe report the actual executable. The command line
> reported by "ps" (from /proc/*/cmdline) can be modified by the program, so
> it doesn't necessarily reflect the program being run.
>
>
>   
That is what I was searching for. It's in ps man page, I don't know why 
I missed it in the first place.
Thanks.

JM



More information about the Python-list mailing list