/** * Build the command string. * * @return string */ public function buildCommand() { $output = ProcessUtils::escapeArgument($this->output); $redirect = $this->shouldAppendOutput ? ' >> ' : ' > '; $command = $this->command . $redirect . $output . ' 2>&1 &'; return $this->user && !windows_os() ? 'sudo -u ' . $this->user . ' -- sh -c \'' . $command . '\'' : $command; }
/** * Build the command string. * * @return string */ public function buildCommand() { $output = ProcessUtils::escapeArgument($this->output); $redirect = $this->shouldAppendOutput ? ' >> ' : ' > '; if ($this->withoutOverlapping) { $forget = Appliation::formatCommandString('cache:forget'); if (windows_os()) { $command = '(' . $this->command . ' & ' . $forget . ' "' . $this->mutexName() . '")' . $redirect . $output . ' 2>&1 &'; } else { $command = '(' . $this->command . '; ' . $forget . ' ' . $this->mutexName() . ')' . $redirect . $output . ' 2>&1 &'; } } else { $command = $this->command . $redirect . $output . ' 2>&1 &'; } return $this->user && !windows_os() ? 'sudo -u ' . $this->user . ' -- sh -c \'' . $command . '\'' : $command; }
/** * Build the command string. * * @return string */ public function buildCommand() { $output = ProcessUtils::escapeArgument($this->output); $redirect = $this->shouldAppendOutput ? ' >> ' : ' > '; if ($this->withoutOverlapping) { if (windows_os()) { $command = '(echo \'\' > "' . $this->mutexPath() . '" & ' . $this->command . ' & del "' . $this->mutexPath() . '")' . $redirect . $output . ' 2>&1 &'; } else { $command = '(touch ' . $this->mutexPath() . '; ' . $this->command . '; rm ' . $this->mutexPath() . ')' . $redirect . $output . ' 2>&1 &'; } } else { $command = $this->command . $redirect . $output . ' 2>&1 &'; } return $this->user ? 'sudo -u ' . $this->user . ' ' . $command : $command; }
/** * Create a hard link to the target file or directory. * * @param string $target * @param string $link * @return void */ public function link($target, $link) { if (!windows_os()) { return symlink($target, $link); } $mode = $this->isDirectory($target) ? 'J' : 'H'; exec("mklink /{$mode} \"{$link}\" \"{$target}\""); }