public function openTunnel(array $config): Process
    {
        $process = new Process($this->createSshCommand($config));
        $process->setTimeout(60);
        $process->start();

        while ($process->isRunning()) {
            sleep(1);
        }

        if ($process->getExitCode() !== 0) {
            throw new SSHException(sprintf(
                "Unable to create ssh tunnel. Output: %s ErrorOutput: %s",
                $process->getOutput(),
                $process->getErrorOutput()
            ));
        }

        return $process;
    }
public function openTunnel(array $config): Process
    {
        $process = new Process($this->createSshCommand($config));
        $process->setTimeout(60);
        $process->start();

        while ($process->isRunning()) {
            sleep(1);
        }

        if ($process->getExitCode() !== 0) {
            throw new SSHException(sprintf(
                "Unable to create ssh tunnel. Output: %s ErrorOutput: %s",
                $process->getOutput(),
                $process->getErrorOutput()
            ));
        }

        return $process;
    }
public function openTunnel ( array $ config ) : Process { $ process = new Process ( $ this -> createSshCommand ( $ config ) ) ; $ process -> setTimeout ( 60 ) ; $ process -> start ( ) ; while ( $ process -> isRunning ( ) ) { sleep ( 1 ) ; } if ( $ process -> getExitCode ( ) !== 0 ) { throw new SSHException ( sprintf ( "Unable to create ssh tunnel. Output: %s ErrorOutput: %s" , $ process -> getOutput ( ) , $ process -> getErrorOutput ( ) ) ) ; } return $ process ; }
Open SSH tunnel defined by config

@param array $config

Configuration fields:

- user: (string) SSH proxy username. Required.
- sshHost: (string) SSH proxy hostname. Required.
- sshPort: (string) SSH protocol port. Optional, default 22.
- localPort: (string) local port. Optional, default 33006.
- remoteHost: (string) destination machine hostname. Required.
- remotePort: (string) destination machine port. Required.
- privateKey: (string) SSH private key. Required.
- compression: (bool) whether to use compression. Optional, default false.


@return Process
@throws SSHException
Open SSH tunnel defined by config