Example #1
0
 /**
  * {@inheritdoc}
  */
 public function chmod($path, $mode)
 {
     $this->incrementPending();
     $promisor = new Deferred();
     $priority = \EIO_PRI_DEFAULT;
     \eio_chmod($path, $mode, $priority, [$this, "onGenericResult"], $promisor);
     return $promisor->promise();
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function chmod(string $path, int $mode) : \Generator
 {
     $delayed = new Delayed();
     \eio_chmod($path, $mode, null, function (Delayed $delayed, $result, $req) {
         if (-1 === $result) {
             $delayed->reject(new FileException(sprintf('Changing the owner failed: %s.', \eio_get_last_error($req))));
         } else {
             $delayed->resolve(true);
         }
     }, $delayed);
     $this->poll->listen();
     try {
         $result = (yield $delayed);
     } finally {
         $this->poll->done();
     }
     return $result;
 }