GeezerVison is showing github.com — src: handle errors from uv_pipe_connect2() · nodejs/node@57587de
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/pipe_wrap.cc +11-8Lines changed: 11 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -225,16 +225,19 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { |
225 | 225 |
|
226 | 226 | ConnectWrap* req_wrap = |
227 | 227 | new ConnectWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPECONNECTWRAP); |
228 | | - req_wrap->Dispatch( |
| 228 | + int err = req_wrap->Dispatch( |
229 | 229 | uv_pipe_connect2, &wrap->handle_, *name, name.length(), 0, AfterConnect); |
| 230 | + if (err) { |
| 231 | + delete req_wrap; |
| 232 | + } else { |
| 233 | + TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native), |
| 234 | + "connect", |
| 235 | + req_wrap, |
| 236 | + "pipe_path", |
| 237 | + TRACE_STR_COPY(*name)); |
| 238 | + } |
230 | 239 |
|
231 | | - TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native), |
232 | | - "connect", |
233 | | - req_wrap, |
234 | | - "pipe_path", |
235 | | - TRACE_STR_COPY(*name)); |
236 | | - |
237 | | - args.GetReturnValue().Set(0); // uv_pipe_connect() doesn't return errors. |
| 240 | + args.GetReturnValue().Set(err); |
238 | 241 | } |
239 | 242 |
|
240 | 243 | } // namespace node |
|