diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-02-13 00:33:20 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-03-15 14:53:06 +0300 |
commit | c412150582de524beacd180646ec5f18c518a922 (patch) | |
tree | 85d153039162678feba5e1cef982d3712364bb37 /src/stream_base-inl.h | |
parent | 8695273948846b999f528ede97c764638fbb6c40 (diff) |
src: make `FileHandle` a (readonly) `StreamBase`
This enables accessing files using a more standard pattern.
Once some more refactoring has been performed on the other existing
`StreamBase` streams, this could also be used to implement `fs`
streams in a more standard manner.
PR-URL: https://github.com/nodejs/node/pull/18936
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/stream_base-inl.h')
-rw-r--r-- | src/stream_base-inl.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index c87393e6fc1..b7495a80ac6 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -146,6 +146,9 @@ inline Environment* StreamBase::stream_env() const { inline int StreamBase::Shutdown(v8::Local<v8::Object> req_wrap_obj) { Environment* env = stream_env(); + + HandleScope handle_scope(env->isolate()); + if (req_wrap_obj.IsEmpty()) { req_wrap_obj = env->shutdown_wrap_constructor_function() @@ -183,6 +186,8 @@ inline StreamWriteResult StreamBase::Write( } } + HandleScope handle_scope(env->isolate()); + if (req_wrap_obj.IsEmpty()) { req_wrap_obj = env->write_wrap_constructor_function() |