Skip to content

Commit

Permalink
[Fix] Fixes escaping issues on remote commands
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-montanez committed Feb 11, 2017
1 parent eddb88b commit 28396c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Runtime/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ public function runRemoteCommand($cmd, $jail, $timeout = 120)
$cmdDelegate = sprintf('cd %s && %s', $hostPath, $cmdDelegate);
}

$cmdRemote = str_replace(['"', '&', ';', '|'], ['\"', '\&', '\;', '\|'], $cmdDelegate);
$cmdLocal = sprintf('ssh -p %d %s %s@%s sh -c \"%s\"', $sshConfig['port'], $sshConfig['flags'], $user, $host, $cmdRemote);
$cmdRemote = str_replace('"', '\"', $cmdDelegate);
$cmdLocal = sprintf('ssh -p %d %s %s@%s "%s"', $sshConfig['port'], $sshConfig['flags'], $user, $host, $cmdRemote);

return $this->runLocalCommand($cmdLocal, $timeout);
}
Expand Down

0 comments on commit 28396c1

Please sign in to comment.