File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313#include < vix/cli/commands/deploy/DeployRunner.hpp>
1414#include < vix/cli/commands/deploy/DeployOutput.hpp>
1515
16- #include < cstdlib>
17- #include < iostream>
18- #include < string>
1916#include < array>
2017#include < cstdio>
18+ #include < cstdlib>
19+ #include < iostream>
2120#include < memory>
2221#include < optional>
22+ #include < string>
23+
24+ #if defined(_WIN32)
25+ #define VIX_CLI_POPEN _popen
26+ #define VIX_CLI_PCLOSE _pclose
27+ #else
28+ #define VIX_CLI_POPEN popen
29+ #define VIX_CLI_PCLOSE pclose
30+ #endif
2331
2432namespace vix ::commands::deploy::runner
2533{
@@ -58,14 +66,16 @@ namespace vix::commands::deploy::runner
5866 std::array<char , 2048 > buffer{};
5967 std::string output;
6068
61- std::unique_ptr<FILE, decltype (&pclose)> pipe (
62- popen (cmd.c_str (), " r" ),
63- pclose);
69+ using PipeCloser = int (*)(FILE *);
70+
71+ std::unique_ptr<FILE, PipeCloser> pipe (
72+ VIX_CLI_POPEN (cmd.c_str (), " r" ),
73+ VIX_CLI_PCLOSE);
6474
6575 if (!pipe)
6676 return std::nullopt ;
6777
68- while (fgets (buffer.data (), static_cast <int >(buffer.size ()), pipe.get ()) != nullptr )
78+ while (std:: fgets (buffer.data (), static_cast <int >(buffer.size ()), pipe.get ()) != nullptr )
6979 output += buffer.data ();
7080
7181 while (!output.empty () &&
You can’t perform that action at this time.
0 commit comments