Skip to content

Commit

Permalink
fixup! fs: improve error performance for mkdirSync
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Sep 25, 2023
1 parent 8ba6057 commit 66f03f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1947,14 +1947,14 @@ static void MKDirSync(const FunctionCallbackInfo<Value>& args) {
bool mkdirp = args[2]->IsTrue();

int err;
FS_SYNC_TRACE_BEGIN(rmdir);
FS_SYNC_TRACE_BEGIN(mkdir);

if (mkdirp) {
FSReqWrapSync req_wrap_sync;

err = MKDirpSync(
env->event_loop(), &(req_wrap_sync.req), *path, mode, nullptr);
FS_SYNC_TRACE_END(rmdir);
FS_SYNC_TRACE_END(mkdir);

if (err == 0 && !req_wrap_sync.continuation_data()->first_path().empty()) {
Local<Value> error;
Expand All @@ -1973,7 +1973,7 @@ static void MKDirSync(const FunctionCallbackInfo<Value>& args) {
auto make = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); });

err = uv_fs_mkdir(nullptr, &req, *path, mode, nullptr);
FS_SYNC_TRACE_END(rmdir);
FS_SYNC_TRACE_END(mkdir);
}

if (err < 0) {
Expand Down

0 comments on commit 66f03f6

Please sign in to comment.