mirror of
https://github.com/danog/file.git
synced 2024-11-26 20:04:51 +01:00
Ignore errors when closing
This commit is contained in:
parent
2ce32d57ff
commit
ad309f0cd2
@ -201,18 +201,9 @@ class EioHandle implements Handle {
|
|||||||
return $deferred->promise();
|
return $deferred->promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onClose($deferred, $result, $req) {
|
private function onClose(Deferred $deferred, $result, $req) {
|
||||||
if ($result === -1) {
|
// Ignore errors when closing file, as the handle will become invalid anyway.
|
||||||
$error = \eio_get_last_error($req);
|
|
||||||
if ($error === "Bad file descriptor") {
|
|
||||||
// Handle is already closed, ignore
|
|
||||||
$deferred->resolve();
|
$deferred->resolve();
|
||||||
} else {
|
|
||||||
$deferred->fail(new StreamException("Closing the file failed: " . $error));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$deferred->resolve();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -247,7 +247,7 @@ class UvHandle implements Handle {
|
|||||||
$this->poll->listen($this->closing = $deferred->promise());
|
$this->poll->listen($this->closing = $deferred->promise());
|
||||||
|
|
||||||
\uv_fs_close($this->loop, $this->fh, function ($fh) use ($deferred) {
|
\uv_fs_close($this->loop, $this->fh, function ($fh) use ($deferred) {
|
||||||
// FIXME: Check for errors
|
// Ignore errors when closing file, as the handle will become invalid anyway.
|
||||||
$deferred->resolve();
|
$deferred->resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user