From ca8ff08a5c9c19c04c1ef6fe15c80fa1fd72a59c Mon Sep 17 00:00:00 2001 From: theanarkh Date: Sat, 7 Jan 2023 07:49:15 +0800 Subject: [PATCH] src: keep PipeWrap::Open function consistent with TCPWrap PR-URL: https://github.com/nodejs/node/pull/46064 Reviewed-By: Darshan Sen Reviewed-By: Anna Henningsen --- src/pipe_wrap.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 98645a4121360b..944d7c3e72c534 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -217,10 +217,9 @@ void PipeWrap::Open(const FunctionCallbackInfo& args) { if (!args[0]->Int32Value(env->context()).To(&fd)) return; int err = uv_pipe_open(&wrap->handle_, fd); - wrap->set_fd(fd); + if (err == 0) wrap->set_fd(fd); - if (err != 0) - env->ThrowUVException(err, "uv_pipe_open"); + args.GetReturnValue().Set(err); }