Ferreteria/v0.6/clade/IO/Aspect/Connx/run/Session/Local/proc/Pipes/@code

From WoozleCodes
Jump to navigation Jump to search
Code Snapshots & Removals
interface iPipes extends BaseIface {
    // ACCESS
    var StreamIface $ProcIStream { get; } // stdin - process reads from this
    var StreamIface $ProcOStream { get; } // stdout - process writes responses to this
    var StreamIface $ProcEStream { get; } // stderr - process writes errors here
}
class cPipes extends BaseClass implements iPipes {

    // ++ CONFIG ++ //

    protected function StreamClass(int $nPipe) : string {
        if ($nPipe === 0) {
            $sc = StrmIClass::class;
        } else {
            $sc = StrmOClass::class;
        }
        return $sc;
    }

    // -- CONFIG -- //
    // ++ ACCESS ++ //

    public StreamIface $ProcIStream { get => $this->ProcIStream ??= $this->StreamIt(0,'stdin'); } // stdin - process reads from this
    public StreamIface $ProcOStream { get => $this->ProcOStream ??= $this->StreamIt(1,'stdout'); } // stdout - process writes to this
    public StreamIface $ProcEStream { get => $this->ProcEStream ??= $this->StreamIt(2,'stderr'); } // stderr - process writes errors here

    // -- ACCESS -- //
    // ++ DIAGS ++ //

    public function VIEW_Inline() : string {
        $sOut = '';
        $ao = $this->AOStreams();
        if (count($ao) > 0) {
            foreach ($ao as $n => $o) {
                if ($sOut !== '') { $sOut .= ' '; }
                $sOut .= '['.$o->VIEW_Inline().']';
            }
        } else {
            $sOut = '(none)';
        }
        return $sOut;
    }
}