Make used shell configurable (#1536)

This commit is contained in:
maximilian-walter 2018-04-18 06:30:19 +02:00 committed by Anton Medvedev
parent 96f5edaebe
commit ac1b970bda
3 changed files with 20 additions and 1 deletions

View File

@ -53,6 +53,7 @@ class FileLoader
'multiplexing',
'sshOptions',
'sshFlags',
'shellCommand',
];
foreach ($methods as $method) {

View File

@ -25,6 +25,7 @@ class Host
private $forwardAgent = true;
private $multiplexing = null;
private $sshArguments;
private $shellCommand = 'bash -s';
/**
* @param string $hostname
@ -239,6 +240,21 @@ class Host
return $this;
}
public function getShellCommand() : string
{
return $this->shellCommand;
}
/**
* @param string $shellCommand
* @return $this
*/
public function shellCommand(string $shellCommand)
{
$this->shellCommand = $shellCommand;
return $this;
}
/**
* Set stage
*

View File

@ -80,7 +80,9 @@ class Client
$sshArguments = $this->initMultiplexing($host);
}
$ssh = "ssh $sshArguments $host $become 'bash -s; printf \"[exit_code:%s]\" $?;'";
$shellCommand = $host->getShellCommand();
$ssh = "ssh $sshArguments $host $become '$shellCommand; printf \"[exit_code:%s]\" $?;'";
$process = new Process($ssh);
$process