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 27, 2023
1 parent 00787ab commit fe28c76
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 @@ -1968,14 +1968,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 @@ -1994,7 +1994,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 fe28c76

Please sign in to comment.