/* Crafter.Build Copyright (C) 2025 Catcrafts® Catcrafts.net This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ module; #include #include #include #include #include #include export module Crafter.Build:Bounce; export void BounceCommand(const std::string& cmd) { // std::array buffer; // std::string result; // std::string with = cmd + " 2>&1"; // // Open pipe to file // FILE* pipe = popen(with.c_str(), "r"); // if (!pipe) throw std::runtime_error("popen() failed!"); // // Read till end of process: // while (fgets(buffer.data(), buffer.size(), pipe) != nullptr) { // result += buffer.data(); // } // // Close pipe // auto returnCode = pclose(pipe); // if (returnCode != 0) { // // Optional: handle non-zero exit status // } // std::cout << result; system(cmd.c_str()); } export void BounceCommandIgnore(const std::string& cmd) { std::string with = cmd + " > /dev/null 2>&1"; FILE* pipe = popen(with.c_str(), "r"); if (!pipe) throw std::runtime_error("popen() failed!"); pclose(pipe); }