cpp-subprocess
cpp-subprocess copied to clipboard
Subprocessing with modern C++
MinGW (Min. GNU for Windows) also requires the Windows-specific code, but doesn't `#define` **_MSC_VER**. All the Windows-specific fixes are ignored. Using a combined definition would solve this.
Some functions are not inline. This will cause multiple definition errors in projects that include your lib. Examples: ``` std::string get_last_error() FILE *file_from_handle(HANDLE h, const char *mode) void configure_pipe(HANDLE* read_handle,...
This behavior is seen in 126ee29. ## Steps to reproduce Compile and run the following program on a non-Windows system: ```c++ #include #include "subprocess.hpp" using namespace subprocess; int main(int argc,...
I see the uses of std::string and setenv after fork. I believe these functions are unsafe, because after fork, the state of memory heap is undefined. I haven't been able...
The class Buffer has ``` std::vector buf; size_t length = 0; ``` This is a bad interface design because the `length` field duplicates the `buf.size()`. At what situations can those...
This is a design issue. Basically there is a problem with definitions like this: ``` struct output { output(int fd): wr_ch_(fd) {} output (FILE* fp):output(fileno(fp)) { assert(fp); } output(const char*...
You have a lot of static inline functions, such as ``` static inline std::vector split(const std::string& str, const std::string& delims=" \t") ``` The problem is, with static functions, the compiler...
The current definition is ``` static inline std::string join(const std::vector& vec, const std::string& sep = " ") { std::string res; for (auto& elem : vec) res.append(elem + sep); res.erase(--res.end()); return...
I would expect this code: ``` using namespace subprocess; auto proc = Popen("ls fdklajfdlsajfdkljaf", error{PIPE}, cwd{where}, shell{true}); auto errors = proc.communicate().first; std::cerr
It would not be a stretch to expect this: ``` auto proc = Popen(subprocess::util::split(command), error{PIPE}, cwd{where}); ``` to compile. Unfortunately it gives the following error: ``` /home/pklos/projects/(...).cpp:70:80: error: no matching...