Ok, so pecl ssh2 is supposedly a wrapper for libssh2. libssh2 has libssh2_channel_get_exit_status. Is there ANY way to get this information?
I NEED:
-STDOUT
-STDERR
-EXIT STATUS
I get all but exit status. A lot of people throw around phplibsec when ssh is brought up, but I see no way of getting stderr or the channel exit status out of that either:/ Has anybody been able to get all three?
So, first thing is first:
NO, they didn't implement libssh2_channel_get_exit_status. Why? Beyond me.
Here is what id did:
$command .= ';echo -e "\n$?"'
I cram a newline and echo of $? onto the end of every command I exec. Rangy? Yes. But it seems to have worked out rather well. I then pull that off into $returnValue and strip all the newlines off the end of stdout. Maybe someday getting the channel's exit status will be supported, and a few years after that it will be in the distro repos. For now, this has been good enough. When your running 30+ remote commands to populate complex remote resources, this is much, much better than setting up and tearing down the ssh session for each command.