Skip to content

Commit

Permalink
src: handle errors from uv_pipe_connect2()
Browse files Browse the repository at this point in the history
We need to handle errors from uv_pipe_connect2()
because return type is `int`.

Fixes: #50652
Refs: #49667
Refs: libuv/libuv#4030
PR-URL: #50657
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: theanarkh <[email protected]>
  • Loading branch information
deokjinkim authored and targos committed Nov 23, 2023
1 parent 3731f83 commit 57587de
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/pipe_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,19 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) {

ConnectWrap* req_wrap =
new ConnectWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPECONNECTWRAP);
req_wrap->Dispatch(
int err = req_wrap->Dispatch(
uv_pipe_connect2, &wrap->handle_, *name, name.length(), 0, AfterConnect);
if (err) {
delete req_wrap;
} else {
TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native),
"connect",
req_wrap,
"pipe_path",
TRACE_STR_COPY(*name));
}

TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native),
"connect",
req_wrap,
"pipe_path",
TRACE_STR_COPY(*name));

args.GetReturnValue().Set(0); // uv_pipe_connect() doesn't return errors.
args.GetReturnValue().Set(err);
}

} // namespace node
Expand Down

0 comments on commit 57587de

Please sign in to comment.