From 91a2812a3158f54078ddd513b60b3d1babd6331e Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Mon, 6 Nov 2023 14:56:07 -0500 Subject: [PATCH] add back error handling that was incorrectly dropped by #4030 --- src/unix/pipe.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/unix/pipe.c b/src/unix/pipe.c index 940b935950f..a5da59229d1 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c @@ -206,7 +206,22 @@ void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb) { - uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); + int err; + + err = uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); + + if (err) { + handle->delayed_error = err; + handle->connect_req = req; + + uv__req_init(handle->loop, req, UV_CONNECT); + req->handle = (uv_stream_t*)handle; + req->cb = cb; + uv__queue_init(&req->queue); + + /* Force callback to run on next tick in case of error. */ + uv__io_feed(handle->loop, &handle->io_watcher); + } }