Fix one-shot commands for a specific container being executed using host environment variables

This commit is contained in:
Mauro E. Bender 2024-05-08 19:20:21 +02:00
parent 94acd12f1c
commit cca1a9832e

View File

@ -122,7 +122,7 @@ public function runCommand()
if ($server->isForceDisabled()) {
throw new \RuntimeException('Server is disabled.');
}
$cmd = 'sh -c "if [ -f ~/.profile ]; then . ~/.profile; fi; ' . str_replace('"', '\"', $this->command) . '"';
$cmd = "sh -c 'if [ -f ~/.profile ]; then . ~/.profile; fi; " . str_replace("'", "'\''", $this->command) . "'";
if (!empty($this->workDir)) {
$exec = "docker exec -w {$this->workDir} {$container_name} {$cmd}";
} else {