From de44085c6daca28ffc83d283db81c22c1fe06b72 Mon Sep 17 00:00:00 2001 From: theanarkh Date: Tue, 3 Jan 2023 00:51:59 +0800 Subject: [PATCH] src: keep the return value of PipeWrap::Open function consistent with TCPWrap --- src/pipe_wrap.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 98645a4121360b..f0cd019f11daae 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -217,10 +217,10 @@ 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); }