in reply to Re: channel SSH2
in thread channel SSH2

Because I was executing long running commands (and even sometimes on the shorter commands), I had to do something like execute a 'echo DONE' command after every command I wanted to execute, and then read from every command until I got the DONE marker. I even went and wrote an execute_command($command) wrapper function to do this for me.

Update: And maybe I even did something like:echo "DONE[$?]"

Replies are listed 'Best First'.
Re^3: channel SSH2
by locked_user sundialsvc4 (Abbot) on May 23, 2012 at 21:48 UTC

    /me nods...

    Very good.   I am definitely a member of the pragmatic school of, “Works for You = Works For Me,” but with one equally pragmatic caution ...

    Be sure to anticipate the error case.   Be sure that you are not inadvertantly “eating up all the evidence” while waiting for a DONE-marker that never comes.   Consider the various ways that things can go wrong, and what will indicate the presence of those failures.   Be certain, by whatever means seem best to you, that the software you are communicating with not only handles the “normal completion” case, but the very-real alternate possibility of abnormal completion as well.   In my experience, so-called ABENDs.   (Caution: old still-sometimes mainframe geek) cannot reliably be discerned from program output, but facilities always exist by which they can reliably be caught.)   Anticipate the train-wrecks and derailings along with everything else.