diff --git a/PHPCI/Helper/SshKey.php b/PHPCI/Helper/SshKey.php index 47bd85bd..932686f2 100644 --- a/PHPCI/Helper/SshKey.php +++ b/PHPCI/Helper/SshKey.php @@ -39,9 +39,9 @@ class SshKey $return = array('private_key' => '', 'public_key' => ''); - if ($this->canGenerateKeys()) { - shell_exec('ssh-keygen -q -t rsa -b 2048 -f '.$keyFile.' -N "" -C "deploy@phpci"'); + $output = @shell_exec('ssh-keygen -t rsa -b 2048 -f '.$keyFile.' -N "" -C "deploy@phpci"'); + if (!empty($output)) { $pub = file_get_contents($keyFile . '.pub'); $prv = file_get_contents($keyFile); @@ -56,16 +56,4 @@ class SshKey return $return; } - - /** - * Checks whether or not we can generate keys, by quietly test running ssh-keygen. - * @return bool - */ - public function canGenerateKeys() - { - $keygen = @shell_exec('ssh-keygen --help'); - $canGenerateKeys = !empty($keygen); - - return $canGenerateKeys; - } }