From 28396c179904c854187fbe91254b330ec631e56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Fri, 10 Feb 2017 22:59:04 -0300 Subject: [PATCH] [Fix] Fixes escaping issues on remote commands --- src/Runtime/Runtime.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runtime/Runtime.php b/src/Runtime/Runtime.php index e03cc48..8383c5d 100644 --- a/src/Runtime/Runtime.php +++ b/src/Runtime/Runtime.php @@ -424,8 +424,8 @@ class Runtime $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); }