GeezerVison is showing github.com — src,fs: remove `ToLocalChecked()` call from `fs::AfterMkdirp()` · nodejs/node@4030eff
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_file.cc +11-16Lines changed: 11 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -714,24 +714,19 @@ void FromNamespacedPath(std::string* path) { |
714 | 714 | void AfterMkdirp(uv_fs_t* req) { |
715 | 715 | FSReqBase* req_wrap = FSReqBase::from_req(req); |
716 | 716 | FSReqAfterScope after(req_wrap, req); |
717 | | - |
718 | | - MaybeLocal<Value> path; |
719 | | - Local<Value> error; |
720 | | - |
721 | 717 | if (after.Proceed()) { |
722 | | - if (!req_wrap->continuation_data()->first_path().empty()) { |
723 | | - std::string first_path(req_wrap->continuation_data()->first_path()); |
724 | | - FromNamespacedPath(&first_path); |
725 | | - path = StringBytes::Encode(req_wrap->env()->isolate(), first_path.c_str(), |
726 | | - req_wrap->encoding(), |
727 | | - &error); |
728 | | - if (path.IsEmpty()) |
729 | | - req_wrap->Reject(error); |
730 | | - else |
731 | | - req_wrap->Resolve(path.ToLocalChecked()); |
732 | | - } else { |
733 | | - req_wrap->Resolve(Undefined(req_wrap->env()->isolate())); |
| 718 | + std::string first_path(req_wrap->continuation_data()->first_path()); |
| 719 | + if (first_path.empty()) |
| 720 | + return req_wrap->Resolve(Undefined(req_wrap->env()->isolate())); |
| 721 | + FromNamespacedPath(&first_path); |
| 722 | + Local<Value> path; |
| 723 | + Local<Value> error; |
| 724 | + if (!StringBytes::Encode(req_wrap->env()->isolate(), first_path.c_str(), |
| 725 | + req_wrap->encoding(), |
| 726 | + &error).ToLocal(&path)) { |
| 727 | + return req_wrap->Reject(error); |
734 | 728 | } |
| 729 | + return req_wrap->Resolve(path); |
735 | 730 | } |
736 | 731 | } |
737 | 732 |
|
|