File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change 22#include < scrypto.hpp>
33
44ff::WADInfo ff::get_info_from_wad (const std::string& wad_path) {
5- const auto recv = [](const std::string&& cmd) -> std::string {
6- std::array<char , 128 > buffer{};
7- std::string result{};
8- std::unique_ptr<FILE, decltype (&pclose)> pipe{popen (cmd.c_str (), " r" ), pclose};
9- if (!pipe) {
10- throw std::runtime_error{" popen() failed!" };
11- }
12- while (fgets (buffer.data (), static_cast <int >(buffer.size ()), pipe.get ()) != nullptr ) {
13- result += buffer.data ();
14- }
15- return result;
16- };
5+ const auto recv = [](const std::string& cmd) -> std::string {
6+ std::array<char , 256 > buffer{};
7+ std::string result;
8+
9+ FILE* raw_pipe = popen (cmd.c_str (), " r" );
10+ if (!raw_pipe) {
11+ throw std::runtime_error{" popen() failed" };
12+ }
13+
14+ std::unique_ptr<FILE, decltype (&pclose)> pipe (raw_pipe, pclose);
15+
16+ while (fgets (buffer.data (), static_cast <int >(buffer.size ()), pipe.get ()) != nullptr ) {
17+ result.append (buffer.data ());
18+ }
19+
20+ return result;
21+ };
1722
1823 const auto extract_value = [](const std::string& output, const std::string& name) -> std::string {
1924 std::stringstream ss{output};
You can’t perform that action at this time.
0 commit comments