Ferreteria/v0.6/clade/IO/Aspect/Connx/Plug/Shell/Remote/SSH/@fx/DoCommand

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | IO‎ | Aspect‎ | Connx‎ | Plug‎ | Shell‎ | Remote‎ | SSH
Jump to navigation Jump to search

About

  • Assumes: connection has been opened

History

  • 2026-01-09 THINKING: It doesn't really make sense to pass in a Stream here, since ssh2_exec() creates one.
    • Also, $oItWent has two Str objects for receiving data -- one for regular replies, one for errors.
    • So: we could either create an ItWent podling that encapsulates reply & error streams, or...
      ...we could just PullBytes() from the returned stream, and stuff them into the reply QStr.
      ...ohbutwait! That must be what $oItWent = $oStream->PullBytes() does, except we need to create & set up $oStream.

Code

as of 2026-01-09 (revision still in progress):

#
    public function DoCommand(CmdLineIface $oCmd, StreamIface $oResps) : CommOpIface {
        $rRecv = ssh2_exec($this->QNative()->GetIt(), $oCmd->AsString());
        $oItWent = $oStream->PullBytes();
        $oItWent->SetOkay(is_resource($rRecv));
        return $oItWent;
    }