diff --git a/src/stream_pipe.cc b/src/stream_pipe.cc index 5f7514b1b8..1271698be7 100644 --- a/src/stream_pipe.cc +++ b/src/stream_pipe.cc @@ -69,8 +69,6 @@ void StreamPipe::Unpipe(bool is_in_deletion) { if (pending_writes_ == 0) sink()->RemoveStreamListener(&writable_listener_); - if (is_in_deletion) return; - // Delay the JS-facing part with SetImmediate, because this might be from // inside the garbage collector, so we can’t run JS here. HandleScope handle_scope(env()->isolate()); @@ -176,9 +174,7 @@ void StreamPipe::WritableListener::OnStreamAfterWrite(WriteWrap* w, } if (pipe->is_eof_) { - HandleScope handle_scope(pipe->env()->isolate()); - InternalCallbackScope callback_scope(pipe, - InternalCallbackScope::kSkipTaskQueues); + AsyncScope async_scope(pipe); pipe->sink()->Shutdown(); pipe->Unpipe(); return;