Skip to content

Commit

Permalink
Use ProcessUtils::escapeArgument() instead of escapeshellarg() for be…
Browse files Browse the repository at this point in the history
…tter compatibility with Windows.
  • Loading branch information
greg-1-anderson committed Jan 21, 2017
1 parent 9a7001a commit 6a17ac3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Commands/Remote/SSHBaseCommand.php
Expand Up @@ -66,7 +66,7 @@ function ($type, $buffer) use ($output) {
$this->log()->notice('Command: {site}.{env} -- {command} [Exit: {exit}]', [
'site' => $this->site->get('name'),
'env' => $this->environment->id,
'command' => escapeshellarg($command_line),
'command' => ProcessUtils::escapeArgument($command_line),
'exit' => $exit,
]);

Expand Down
3 changes: 2 additions & 1 deletion src/Models/Environment.php
Expand Up @@ -14,6 +14,7 @@
use Robo\Common\ConfigAwareTrait;
use Robo\Contract\ConfigAwareInterface;
use Pantheon\Terminus\Exceptions\TerminusException;
use Symfony\Component\Process\ProcessUtils;

/**
* Class Environment
Expand Down Expand Up @@ -733,7 +734,7 @@ public function sendCommandViaSsh($command, $callback = null)
$sftp = $this->sftpConnectionInfo();
$ssh_command = vsprintf(
'ssh -T %s@%s -p %s -o "AddressFamily inet" %s',
[$sftp['username'], $sftp['host'], $sftp['port'], escapeshellarg($command),]
[$sftp['username'], $sftp['host'], $sftp['port'], ProcessUtils::escapeArgument($command),]
);

// Catch Terminus running in test mode
Expand Down

0 comments on commit 6a17ac3

Please sign in to comment.