Skip to content

Commit

Permalink
improved CommandController: + multiline commands
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed May 11, 2016
1 parent 05cfb26 commit 40bc31c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/controllers/CommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 40bc31c

Please sign in to comment.