#!/usr/bin/env php setViewer($viewer) ->withCallsigns(array($target_name)) ->executeOne(); if (!$repository) { throw new Exception(pht('No repository with callsign "%s"!', $target_name)); } $pattern = array(); $arguments = array(); $pattern[] = 'ssh'; $pattern[] = '-o'; $pattern[] = 'StrictHostKeyChecking=no'; $credential_phid = $repository->getCredentialPHID(); if ($credential_phid) { $key = PassphraseSSHKey::loadFromPHID($credential_phid, $viewer); $pattern[] = '-l %P'; $arguments[] = $key->getUsernameEnvelope(); $pattern[] = '-i %P'; $arguments[] = $key->getKeyfileEnvelope(); } $pattern[] = '--'; $passthru_args = array_slice($argv, 1); foreach ($passthru_args as $passthru_arg) { $pattern[] = '%s'; $arguments[] = $passthru_arg; } $pattern = implode(' ', $pattern); array_unshift($arguments, $pattern); $err = newv('PhutilExecPassthru', $arguments) ->execute(); exit($err);