holgur has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, i try to get information about vmware servers with Net::SSH::Expect, but i seem to have some sort of "buffer problem".

When i use the $ssh->send() and $ssh->exec() commands to execute commands remotely and process the output. On some machines however, the output gets "delayed", for example:
> $line = $ssh->exec("XXX");
$line is empty, next command is
> $ssh->send("YYY");
Now the output from XXX appears, followed by the output from "YYY"!

Can someone provide me with enlightenment?

Thanks,
holgur

Replies are listed 'Best First'.
Re: strange behavior of Net::SSH::Expect
by salva (Canon) on May 11, 2009 at 10:53 UTC
Re: strange behavior of Net::SSH::Expect
by almut (Canon) on May 11, 2009 at 11:46 UTC

    It's hard to help without knowing what those XXX and YYY commands are.  So just some general comment: it's not possible to externally influence the bufferering behavior of a program except by providing some execution context that the program itself might test, like interactive vs. non-interactive mode (the former is usually assumed when the std* file handles are connected to a (pseudo-)tty).  Or by using some interface that the program might explicitly provide for that purpose (usually not available).

    In other words, if XXX is not flushing its output in time, you'd have to look into why it (XXX, not Net::SSH::Expect) is not doing it...