public function buildCommand()
{
$command = '';
if ($this->cwd) {
if ($this->user) {
$command .= $this->sudo();
}
$command .= 'cd ' . $this->cwd . '; ';
}
if ($this->user) {
$this->sudo();
}
$command .= $this->isClosure() ? $this->serializeClosure($this->command) : $this->command;
return trim($command, '& ');
}