| 2713 | } |
| 2714 | |
| 2715 | int cmcmd::RunPreprocessor(std::vector<std::string> const& command, |
| 2716 | std::string const& intermediate_file) |
| 2717 | { |
| 2718 | cmUVProcessChainBuilder builder; |
| 2719 | |
| 2720 | uv_fs_t fs_req; |
| 2721 | int preprocessedFile = |
| 2722 | uv_fs_open(nullptr, &fs_req, intermediate_file.c_str(), O_CREAT | O_RDWR, |
| 2723 | 0644, nullptr); |
| 2724 | uv_fs_req_cleanup(&fs_req); |
| 2725 | |
| 2726 | builder |
| 2727 | .SetExternalStream(cmUVProcessChainBuilder::Stream_OUTPUT, |
| 2728 | preprocessedFile) |
| 2729 | .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR) |
| 2730 | .AddCommand(command); |
| 2731 | auto process = builder.Start(); |
| 2732 | if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { |
| 2733 | std::cerr << "Failed to start preprocessor."; |
| 2734 | return 1; |
| 2735 | } |
| 2736 | if (!process.Wait()) { |
| 2737 | std::cerr << "Failed to wait for preprocessor"; |
| 2738 | return 1; |
| 2739 | } |
| 2740 | if (process.GetStatus(0).ExitStatus != 0) { |
| 2741 | cmUVIStream errorStream(process.ErrorStream()); |
| 2742 | std::cerr << errorStream.rdbuf(); |
| 2743 | |
| 2744 | return 1; |
| 2745 | } |
| 2746 | return 0; |
| 2747 | } |
| 2748 | |
| 2749 | int cmcmd::RunLLVMRC(std::vector<std::string> const& args) |
| 2750 | { |
nothing calls this directly
no test coverage detected