diff --git a/src/node_file.cc b/src/node_file.cc index ad0c7b4f9bd..660e3305cd5 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -664,8 +664,8 @@ static Handle Open(const Arguments& args) { ASYNC_CALL(open, args[3], *path, flags, mode) } else { int fd = open(*path, flags, mode); - SetCloseOnExec(fd); if (fd < 0) return ThrowException(ErrnoException(errno, NULL, "", *path)); + SetCloseOnExec(fd); return scope.Close(Integer::New(fd)); } }