This commit is contained in:
Arun M 2020-06-13 13:06:28 +05:30
commit 718d0c816a
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
![Subprocessing in C++]
## [Subprocessing in C++]
## Design Goals
The only goal was to develop something that is as close as python2.7 subprocess module in dealing with processes.

View File

@ -674,7 +674,7 @@ struct input
}
input(IOTYPE typ) {
assert (typ == PIPE && "STDOUT/STDERR not allowed");
#ifndef _MSC_VER
#ifndef _MSC_VER
std::tie(rd_ch_, wr_ch_) = util::pipe_cloexec();
#endif
}
@ -1303,7 +1303,10 @@ inline int Popen::wait() noexcept(false)
inline int Popen::poll() noexcept(false)
{
int status;
#ifndef _MSC_VER
if (!child_created_) return -1; // TODO: ??
#endif
#ifdef _MSC_VER
int ret = WaitForSingleObject(process_handle_, 0);
@ -1672,12 +1675,11 @@ namespace detail {
std::string err_msg(exp.what());
//ATTN: Can we do something on error here ?
util::write_n(err_wr_pipe_, err_msg.c_str(), err_msg.length());
throw;
}
// Calling application would not get this
// exit failure
exit (EXIT_FAILURE);
_exit (EXIT_FAILURE);
#endif
}