[paramiko] getting stdout and stderr together

james bardin jbardin at bu.edu
Mon Nov 23 07:28:09 PST 2009


On Mon, Nov 23, 2009 at 7:36 AM, Marcin Krol <mrkafk at gmail.com> wrote:
> Hello,
>
> Is there any way to get standard output and standard error arranged
> chronologically together in one text stream as they come from ssh server,
> while doing connection_object.exec_command() of course?
>
> Sometimes you do want to separate standard output from standard error. But
> sometimes you don't.


No. Stdout and stderr are always two separate streams. If the timing
is important, you would have to combine the streams on the sender with
something like '2>&1'. Do note though, that you can't necessarily rely
on the order of stdout/stderr being meaningful from a single process,
because stdout and stderr are often buffered differently.

-jim



More information about the paramiko mailing list