public function sendCommandViaSsh($command)
{
$sftp = $this->sftpConnectionInfo();
$ssh_command = vsprintf('ssh -T %s@%s -p %s -o "AddressFamily inet" %s', [$sftp['username'], $sftp['host'], $sftp['port'], escapeshellarg($command)]);
// Catch Terminus running in test mode
if ($this->getConfig()->get('test_mode')) {
return ['output' => "Terminus is in test mode. " . "Environment::sendCommandViaSsh commands will not be sent over the wire. " . "SSH Command: {$ssh_command}", 'exit_code' => 0];
}
ob_start();
passthru($ssh_command, $exit_code);
$response = ['output' => ob_get_clean(), 'exit_code' => $exit_code];
return $response;
}