1
0
mirror of https://github.com/danog/file.git synced 2024-11-26 11:54:54 +01:00

Ignore errors when closing

This commit is contained in:
Aaron Piotrowski 2017-06-23 17:47:22 -05:00
parent 2ce32d57ff
commit ad309f0cd2
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
2 changed files with 4 additions and 13 deletions

View File

@ -201,18 +201,9 @@ class EioHandle implements Handle {
return $deferred->promise();
}
private function onClose($deferred, $result, $req) {
if ($result === -1) {
$error = \eio_get_last_error($req);
if ($error === "Bad file descriptor") {
// Handle is already closed, ignore
private function onClose(Deferred $deferred, $result, $req) {
// Ignore errors when closing file, as the handle will become invalid anyway.
$deferred->resolve();
} else {
$deferred->fail(new StreamException("Closing the file failed: " . $error));
}
} else {
$deferred->resolve();
}
}
/**

View File

@ -247,7 +247,7 @@ class UvHandle implements Handle {
$this->poll->listen($this->closing = $deferred->promise());
\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();
});