private function asseticDump(OutputInterface $output, KernelInterface $kernel) { $consolePath = $kernel->getRootDir() . '/console'; $assetProcess = new Process('php ' . $consolePath . ' assets:install --env=prod && php ' . $consolePath . ' assetic:dump --env=prod && php ' . $consolePath . ' cache:clear --env=prod', $kernel->getRootDir() . '/..', null, null, 600); $assetProcess->setPty(true); try { $assetProcess->mustRun(); $output->writeln($assetProcess->getOutput()); } catch (ProcessFailedException $e) { echo $e->getMessage(); $output->writeln($e->getMessage()); } if ($assetProcess->isSuccessful()) { $output->writeln('<info>Assets succesfully installed</info>'); } else { $output->writeln('<error>Assets installation failed</error>'); } }
public function addKey(SshPrivateKey $key) { if (!$this->isRunning()) { // No point in trying to add a key to an agent that is not running // so abort early return false; } // Save the key to a temporary file $tmpKey = tempnam(sys_get_temp_dir(), 'codeaken_sshagent_'); file_put_contents($tmpKey, $key->getKeyData(SshKey::FORMAT_PKCS8)); $sshAdd = new Process("ssh-add {$tmpKey}", null, ['SSH_AUTH_SOCK' => $this->getSocket()], $key->getPassword() . "\n"); $sshAdd->setPty(true); $sshAdd->run(); if (!$sshAdd->isSuccessful()) { unlink($tmpKey); return false; } unlink($tmpKey); return true; }