diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 11126c478f76f7..db5a66bc54cc54 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -457,9 +457,17 @@ Maybe SyncProcessRunner::TryInitializeAndRunLoop(Local options) { SetError(UV_ENOMEM); return Just(false); } - CHECK_EQ(uv_loop_init(uv_loop_), 0); + + r = uv_loop_init(uv_loop_); + if (r < 0) { + delete uv_loop_; + uv_loop_ = nullptr; + SetError(r); + return Just(false); + } if (!ParseOptions(options).To(&r)) return Nothing(); + if (r < 0) { SetError(r); return Just(false);