| Index: runtime/bin/eventhandler_macos.cc
|
| diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
|
| index fbced64683ed5af4894d8f780354962c58a50bcb..91c3bf70a1b2100aba3d591640a0310400f4fcc6 100644
|
| --- a/runtime/bin/eventhandler_macos.cc
|
| +++ b/runtime/bin/eventhandler_macos.cc
|
| @@ -102,7 +102,15 @@ static void UpdateKqueue(intptr_t kqueue_fd_, SocketData* sd) {
|
| int status =
|
| TEMP_FAILURE_RETRY(kevent(kqueue_fd_, events, changes, NULL, 0, NULL));
|
| if (status == -1) {
|
| - FATAL1("Failed updating kqueue: %s\n", strerror(errno));
|
| + // kQueue does not accept the file descriptor. It could be due to
|
| + // already closed file descriptor, or unuspported devices, such
|
| + // as /dev/null. In such case, mark the file descriptor as closed,
|
| + // so dart will handle it accordingly.
|
| + sd->set_write_tracked_by_kqueue(false);
|
| + sd->set_read_tracked_by_kqueue(false);
|
| + sd->ShutdownRead();
|
| + sd->ShutdownWrite();
|
| + DartUtils::PostInt32(sd->port(), 1 << kCloseEvent);
|
| }
|
| }
|
| }
|
|
|