Make the dependency on stdbuf optional for everything but notify

This commit is contained in:
Robin Appelman 2016-06-13 14:14:26 +02:00
commit 2a101e73bc
3 changed files with 31 additions and 1 deletions

View file

@ -14,6 +14,8 @@ class System {
private $net;
private $stdbuf;
public static function getFD($num) {
$folders = array(
'/proc/self/fd',
@ -40,4 +42,14 @@ class System {
}
return $this->net;
}
public function hasStdBuf() {
if (!$this->stdbuf) {
$result = null;
$output = array();
exec('which stdbuf 2>&1', $output, $result);
$this->stdbuf = $result === 0;
}
return $this->stdbuf;
}
}