Ferreteria/v0.6/clade/IO/Aspect/Connx/Stream/Runner/Local/@fx/DoCommand

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | IO‎ | Aspect‎ | Connx‎ | Stream‎ | Runner‎ | Local
Jump to navigation Jump to search

About

  • Action: Opens a process to execute the command ($o) and returns the results.
    • If an output stream object is specified (in QRecver(), that is used to capture the output.
    • The command-string actually gets sent by ActualOpen(), invoked by Open().

History

  • 2024-11-24 created. This is experimental; if it works, this kind of thing should probably be encapsulated in its own class.
  • 2024-11-25 moved from shell/Secure to Shell
  • 2026-01-20 was Run(); renamed to DoCommand (it already matched the definition)

Code

As of 2026-01-17:

#
    public function Run() : CommOpObjIface {
        $this->Open();

        $oBuffErrs = $this->GetErrsBuff();  // new in-mem buffer for any errors
        $oBuffRecv = $this->RecverStream(); // new in-mem buffer for any responses

        $oBuffErrs->Open();
        $oBuffRecv->Open();

        $oaPipes = $this->OAPipes();

        $oAct = $this->PipeToStream(TRUE);  // send from... something to something... (2026-01-04 sorting this out)

        $this->Shut();
        $oBuffRecv->Shut();
        $oBuffErrs->Shut();

        return $oAct;
    }

Obsolete

This and PipeToStream() (which it calls) have a lot of overlap with what Convey() does, and I'm trying to figure out if they can be consolidated.

  • Q1: what is the relationship between a Buffer and a Stream?
    • A: Tentatively, a Buffer is actually a type of Stream -- so we should be able to pass a Buffer wherever a Stream is needed.
  • Q2: What is the relationship between GetErrsBuff() and $oaPipes->ErrsQRes()?
    • A: