cpp-subprocess
cpp-subprocess copied to clipboard
Popen fails to return error code in shell mode
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 << errors.buf.data() << std::endl;
int exit_code = proc.wait();
if(exit_code != 0)
{
cerr << "the command " << command << " returned error code " << exit_code << endl;
exit(1);
}
to set the exit_code
variable to 2 and exit. Instead it sets it to 0 and goes on.