| 2733 | } |
| 2734 | |
| 2735 | void WasmRuntime::formatWaAsync(String fullPath, const std::function<void(String)>& callback) { |
| 2736 | #ifdef DORA_NO_WA |
| 2737 | DORA_UNUSED_PARAM(fullPath); |
| 2738 | Error("Wa format not supported"); |
| 2739 | callback(Slice::Empty); |
| 2740 | #else // !DORA_NO_WA |
| 2741 | #if BX_PLATFORM_ANDROID |
| 2742 | if (!_thread) { |
| 2743 | _thread = SharedAsyncThread.newThread(); |
| 2744 | } |
| 2745 | _thread->run([fullPath = fullPath.toString()]() { |
| 2746 | auto result = WaFormat(c_cast<char*>(fullPath.c_str())); |
| 2747 | std::string data = result ? std::string(result) : ""s; |
| 2748 | if (result) { |
| 2749 | WaFreeCString(result); |
| 2750 | } |
| 2751 | return Values::alloc(std::move(data)); |
| 2752 | }, |
| 2753 | [callback](Own<Values> values) { |
| 2754 | std::string data; |
| 2755 | values->get(data); |
| 2756 | callback(data); |
| 2757 | }); |
| 2758 | #else // BX_PLATFORM_ANDROID |
| 2759 | if (!_thread) { |
| 2760 | _thread = SharedAsyncThread.newThread(); |
| 2761 | } |
| 2762 | _thread->run([fullPath = fullPath.toString()]() { |
| 2763 | auto result = WaFormat(c_cast<char*>(fullPath.c_str())); |
| 2764 | std::string data = result ? std::string(result) : ""s; |
| 2765 | if (result) { |
| 2766 | WaFreeCString(result); |
| 2767 | } |
| 2768 | return Values::alloc(std::move(data)); |
| 2769 | }, |
| 2770 | [callback](Own<Values> values) { |
| 2771 | std::string data; |
| 2772 | values->get(data); |
| 2773 | callback(data); |
| 2774 | }); |
| 2775 | #endif // BX_PLATFORM_ANDROID |
| 2776 | #endif // !DORA_NO_WA |
| 2777 | } |
| 2778 | |
| 2779 | static bool IsGitTerminalStatus(const std::string& status) { |
| 2780 | return status.find("\"state\":\"done\"") != std::string::npos |