| 2655 | }; |
| 2656 | |
| 2657 | int EditorExportPlatformAppleEmbedded::_execute(const String &p_path, const List<String> &p_arguments, std::function<void(const String &)> p_on_data) { |
| 2658 | Dictionary pipe_info = OS::get_singleton()->execute_with_pipe(p_path, p_arguments, false); |
| 2659 | ERR_FAIL_COND_V_MSG(pipe_info.is_empty(), 1, "execute_with_pipe failed"); |
| 2660 | |
| 2661 | Ref<FileAccess> fa_stdout = pipe_info["stdio"]; |
| 2662 | Ref<FileAccess> fa_stderr = pipe_info["stderr"]; |
| 2663 | OS::ProcessID pid = pipe_info["pid"]; |
| 2664 | |
| 2665 | FileReader stdout_r(fa_stdout); |
| 2666 | FileReader stderr_r(fa_stderr); |
| 2667 | |
| 2668 | while (true) { |
| 2669 | String output; |
| 2670 | stdout_r.get_lines(output); |
| 2671 | stderr_r.get_lines(output); |
| 2672 | if (!output.is_empty()) { |
| 2673 | p_on_data(output); |
| 2674 | } |
| 2675 | |
| 2676 | // If the process is no longer running and no new data arrived, we're done. |
| 2677 | if (output.is_empty() && !OS::get_singleton()->is_process_running(pid)) { |
| 2678 | break; |
| 2679 | } |
| 2680 | |
| 2681 | OS::get_singleton()->delay_usec(1000); |
| 2682 | } |
| 2683 | |
| 2684 | // Flush any remaining content |
| 2685 | String output; |
| 2686 | stdout_r.flush(output); |
| 2687 | stderr_r.flush(output); |
| 2688 | if (!output.is_empty()) { |
| 2689 | p_on_data(output); |
| 2690 | } |
| 2691 | |
| 2692 | fa_stdout->close(); |
| 2693 | fa_stderr->close(); |
| 2694 | |
| 2695 | return OS::get_singleton()->get_process_exit_code(pid); |
| 2696 | } |
| 2697 | |
| 2698 | #endif |
| 2699 |
nothing calls this directly
no test coverage detected