Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/PhutilExecutableFuture.php
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | abstract class PhutilExecutableFuture extends Future { | ||||
* the subprocess will execute). If not set, the default value is the parent's | * the subprocess will execute). If not set, the default value is the parent's | ||||
* current working directory. | * current working directory. | ||||
* | * | ||||
* @param string Directory to execute the subprocess in. | * @param string Directory to execute the subprocess in. | ||||
* @return this | * @return this | ||||
* @task config | * @task config | ||||
*/ | */ | ||||
final public function setCWD($cwd) { | final public function setCWD($cwd) { | ||||
$this->cwd = (string)$cwd; | $cwd = (string)$cwd; | ||||
if (!is_dir($cwd)) { | |||||
throw new Exception( | |||||
pht( | |||||
'Preparing to run a command in directory "%s", but that '. | |||||
'directory does not exist.', | |||||
$cwd)); | |||||
} | |||||
$this->cwd = $cwd; | |||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* Get the command's current working directory. | * Get the command's current working directory. | ||||
* | * | ||||
* @return string Working directory. | * @return string Working directory. | ||||
* @task config | * @task config | ||||
*/ | */ | ||||
final public function getCWD() { | final public function getCWD() { | ||||
return $this->cwd; | return $this->cwd; | ||||
} | } | ||||
} | } |