From cca1a9832ec178d22d0c1f781059671f5145e235 Mon Sep 17 00:00:00 2001 From: "Mauro E. Bender" Date: Wed, 8 May 2024 19:20:21 +0200 Subject: [PATCH] Fix one-shot commands for a specific container being executed using host environment variables --- app/Livewire/Project/Shared/ExecuteContainerCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index 52d628dc1..4fc8bb8c6 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -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 {