From 40bc31ca4112772b126744543110290c4500aa65 Mon Sep 17 00:00:00 2001 From: Andrii Vasyliev Date: Tue, 10 May 2016 11:08:23 -0400 Subject: [PATCH] improved CommandController: + multiline commands --- src/controllers/CommandController.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/controllers/CommandController.php b/src/controllers/CommandController.php index 7a0c438..386ce8a 100644 --- a/src/controllers/CommandController.php +++ b/src/controllers/CommandController.php @@ -25,9 +25,20 @@ class CommandController extends CommonController protected $_cwd; + public function setCommands($value) + { + $this->command = $value; + } + public function actionSave() { - passthru(($this->sudo ? 'sudo ' : '') . $this->command); + $commands = explode("\n", $this->command); + foreach ($commands as $command) { + $command = trim($command); + if ($command) { + passthru(($this->sudo ? 'sudo ' : '') . $command); + } + } } public function actionBefore()