Merge pull request #2173 from maurobender/fix_one_shot_commands_executing_using_host_environment

Fix one-shot commands for a specific container being executed using host environment variables
This commit is contained in:
Andras Bacsai 2024-05-10 09:45:54 +02:00 committed by GitHub
commit 00e7167174
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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 {