mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-05 00:48:57 +02:00
force use of sh on remote server and make directory ownership check more portable
This commit is contained in:
@@ -170,9 +170,10 @@ abstract class AbstractTask
|
||||
* Runs a Shell Command on the Remote Host
|
||||
* @param string $command
|
||||
* @param string $output
|
||||
* @param boolean $cdToDirectoryFirst
|
||||
* @return boolean
|
||||
*/
|
||||
protected final function runCommandRemote($command, &$output = null)
|
||||
protected final function runCommandRemote($command, &$output = null, $cdToDirectoryFirst = true)
|
||||
{
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
if ($this instanceOf IsReleaseAware) {
|
||||
@@ -194,9 +195,15 @@ abstract class AbstractTask
|
||||
|
||||
$localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
|
||||
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
|
||||
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ' '
|
||||
. '"cd ' . rtrim($this->getConfig()->deployment('to'), '/') . $releasesDirectory . ' && '
|
||||
. str_replace('"', '\"', $command) . '"';
|
||||
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName();
|
||||
|
||||
$remoteCommand = str_replace('"', '\"', $command);
|
||||
if($cdToDirectoryFirst){
|
||||
$remoteCommand = 'cd ' . rtrim($this->getConfig()->deployment('to'), '/') . $releasesDirectory . ' && ' . $remoteCommand;
|
||||
}
|
||||
$localCommand .= ' ' . '"sh -c \"' . $remoteCommand . '\""';
|
||||
|
||||
Console::log('Run remote command ' . $remoteCommand);
|
||||
|
||||
return $this->runCommandLocal($localCommand, $output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user