Pipe the command into given command

@param  \SebastianFeldmann\Cli\Command $cmd
@return void
513889
public function pipeOutputTo(Command $cmd) : void
    {
        if (!$this->canPipe()) {
            throw new RuntimeException('Can\'t pipe output');
        }
        $this->pipeline[] = $cmd;
    }
1027618
public function executeCommandInProcess($cmd, $timeout = null){
        Context::get('output')->write("<comment>$cmd</comment>\n\n");
        $process = new Process($cmd);

        if ($timeout !== null) {
            $process->setTimeout($timeout);
        }

        $process->run(function ($type, $buffer) {
            Context::get('output')->write($buffer);
        });
        return $process;
    }
888773
private function execute($cmd)
    {
        $process = new Process($cmd, $this->sourceFolder);
        $process->run();
        if (!$process->isSuccessful()) {
            throw new \RuntimeException($process->getErrorOutput());
        }
        $this->output = trim($process->getOutput(), PHP_EOL);
    }
805623
function write($cmd)
    {
        if (!$this->isAuthenticated()) {
            user_error('Operation disallowed prior to login()');
            return false;
        }

        if (!($this->bitmap & NET_SSH2_MASK_SHELL) && !$this->_initShell()) {
            user_error('Unable to initiate an interactive shell session');
            return false;
        }

        return $this->_send_channel_packet($this->_get_interactive_channel(), $cmd);
    }
83958
function cmd_SITE($fd, $cmd)
    {
        if (substr($cmd[1], 0, 6) == "CHMOD ")
        {
            $user = $this->getUser($fd);
            $chmod = explode(" ", $cmd[1], 3);
            $file = $this->fillDirName($user, $chmod[2]);
            $this->debug("CHMOD: $file to {$chmod[1]}");
            if (chmod($file, octdec($chmod[1])))
            {
                $this->send($fd, "200 Permissions changed on {$chmod[2]}");
            }
            else
            {
                $this->send($fd, "550 Could not change perms on " . $chmod[2] . ": Permission denied");
            }
        }
        else
        {
            $this->send($fd, "500 Unknown Command");
        }
    }
1158858
static function execute($cmd)
    {
        $result = '';
        echo 'Executing ' . $cmd . PHP_EOL;
        $result = shell_exec($cmd);
        echo($result);
        return $result;
    }
346211
function cmd_DELE($fd, $cmd)
    {
        $user = $this->getUser($fd);
        $file = $this->fillDirName($user, $cmd[1]);
        $this->debug("DEL: $file");
        if (!file_exists($file))
        {
            $this->send($fd, "550 Could not delete " . $cmd[1] . ": No such file or directory");
        }
        elseif (unlink($file))
        {
            $this->send($fd, "250 Deleted " . $cmd[1]);
        }
        else
        {
            $this->send($fd, "550 Could not delete " . $cmd[1] . ": Permission denied");
        }
    }
1283300
protected function sendCommand($cmd)
    {
        if ($this->shutdown) {
            throw new Exception('This server has been shut down');
        }

        fwrite($this->conn,
               $cmd . "\r\n",
               Connection::stringLength($cmd . "\r\n"));
    }
587097
function runCmd(cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, {}, function(err, stdout) {
      if(err) {
        console.error(stdout);
        return reject(err);
      }

      return resolve(stdout);
    });
  });
}
373328
public function exec($cmd)
    {
        
        if ($this->jumphost) {
            $cmd = "ssh " . $this->jumphost . " " . $cmd;
        }
        
        if ( ! ($stream = ssh2_exec($this->connection, $cmd))) {
            throw new \Exception('SSH command failed');
        }
        stream_set_blocking($stream, true);
        $data = "";
        while ($buf = fread($stream, 4096)) {
            $data .= $buf;
        }
        fclose($stream);
        
        return $data;
    }
1127112
public function fire(Command $command)
    {
        $this->command = $command;

        if ($command->option('verbose')) {
            $command->blockMessage('User', 'Creating Admin User...', 'comment');
        }

        $this->seedAdminRole();
        $this->createFirstUser();
    }
894505
public function fire(Command $command)
    {
        if ($command->option('verbose')) {
            $command->blockMessage('Seeds', 'Running the module seeds ...', 'comment');
        }

        $this->demoSeedCoreModules($command);
        $this->demoSeedAdditionalModules($command);
    }
760594
function cmd_MKD($fd, $cmd)
    {
        $user = $this->getUser($fd);
        $path = $this->getAbsDir($user).$cmd[1];

        if (!is_dir(dirname($path)))
        {
            $this->send($fd, "550 Can't create directory: No such file or directory");
        }
        elseif(file_exists($path))
        {
            $this->send($fd, "550 Can't create directory: File exists");
        }
        else
        {
            if (mkdir($path))
            {
                $this->send($fd, "257 \"" . $cmd[1] . "\" : The directory was successfully created");
            }
            else
            {
                $this->send($fd, "550 Can't create directory: Permission denied");
            }
        }
    }
1197402
protected function shell($cmd, $passthru = false)
    {
        $out = [];
        $return = 0;

        if (true === $passthru) {
            passthru(sprintf('%s 2>&1', $cmd), $return);
            $out = null;
        } else {
            exec(sprintf('%s 2>&1', $cmd), $out, $return);
            $out = join(PHP_EOL, $out);
            if ($this->getOutput()->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) {
                $this->getOutput()->writeln($out);
            }
        }

        if (0 < $return) {
            throw new \RuntimeException(sprintf("Error when executing '%s'", $cmd), 50);
        }

        return $out;
    }
780743
public function rawcommand($command)
    {
        if (preg_match('/(.+)[\n]$/', $command)) {
            $this->socket->send($command);
        } else {
            $this->socket->send($command.PHP_EOL);
        }
    }
556617
private function _negotiateWill($cmd) {
        switch ($cmd) {
            case TEL_GA:
                break;
            case TEL_ECHO:
                break;
            default:
                return $this->send(TEL_IAC.TEL_WONT.$cmd, false);
        }
    }
1343464
public function execute($cmd, $data)
    {
        // Use pipes for STDIN, STDOUT, and STDERR
        $descr = array(
          0 => array(
            'pipe',
            'r'
          ) ,
          1 => array(
            'pipe',
            'w'
          ) ,
          2 => array(
            'pipe',
            'w'
          )
        );
        $pipes = [];

        // Start process, telling it to use STDIN for input and STDOUT for output.
        $cmd = escapeshellcmd($cmd);
        $process = proc_open($cmd, $descr, $pipes);

        // Get the data into pipe only if data is resource
        if (gettype($data) == "resource") {
            // Stream input to STDIN
            while (!feof($data)) {
                fwrite($pipes[0], fread($data, 1024));
            }

            // Close STDIN and the source data.
            fclose($pipes[0]);
            fclose($data);
        }

        // Wait for process to finish while reading STDOUT to a temp stream.
        // Otherwise the process can block indefinitely if STODUT gets bigger
        // than 4kb.
        $this->output = fopen("php://temp", 'w+');
        $exit_code = null;
        while ($exit_code === null) {
            $status = proc_get_status($process);
            if ($status['running'] === false) {
                $exit_code = $status['exitcode'];
            }

            $chunk = stream_get_contents($pipes[1]);
            if ($chunk !== false) {
                fwrite($this->output, $chunk);
            }
        }

        // Close STDOUT
        fclose($pipes[1]);

        // On error, extract message from STDERR and throw an exception.
        if ($exit_code != 0) {
            $msg = stream_get_contents($pipes[2]);
            $this->cleanup($pipes, $this->output, $process);
            if ($this->log) {
                $this->log->error('Process exited with non-zero code.', [
                  'exit_code' => $exit_code,
                  'stderr' => $msg,
                ]);
            }
            throw new \RuntimeException($msg, 500);
        }

        // Return a function that streams the output.
        return function () use ($pipes, $process) {
            rewind($this->output);
            while (!feof($this->output)) {
                echo fread($this->output, 1024);
                ob_flush();
                flush();
            }
            $this->cleanup($pipes, $this->output, $process);
        };
    }