Skip to content

Commit

Permalink
src: fix abort on uv_loop_init() failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Aug 22, 2020
1 parent 44e6a6a commit 053aa8d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/spawn_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,17 @@ Maybe<bool> SyncProcessRunner::TryInitializeAndRunLoop(Local<Value> 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<bool>();

if (r < 0) {
SetError(r);
return Just(false);
Expand Down

0 comments on commit 053aa8d

Please sign in to comment.