pharext\ExecCmd::setSu PHP Method

setSu() public method

(Re-)set sudo command
public setSu ( string $sudo = false )
$sudo string
    public function setSu($sudo = false)
    {
        $this->sudo = $sudo;
    }

Usage Example

Beispiel #1
0
 /**
  *
  * @param bool $verbose
  * @throws \pharext\Exception
  */
 public function run($verbose = false)
 {
     if ($verbose !== false) {
         printf("Running make");
         if ($this->args) {
             foreach ($this->args as $arg) {
                 printf(" %s", $arg);
             }
         }
         printf(" ...\n");
     }
     $pwd = getcwd();
     if (!chdir($this->cwd)) {
         throw new Exception();
     }
     try {
         $cmd = new ExecCmd("make", $verbose);
         if (isset($this->sudo)) {
             $cmd->setSu($this->sudo);
         }
         $args = $this->args;
         if (!$verbose) {
             $args = array_merge((array) $args, ["-s"]);
         }
         $cmd->run($args);
     } finally {
         chdir($pwd);
     }
 }
All Usage Examples Of pharext\ExecCmd::setSu