This commit is contained in:
q66 2017-05-09 20:40:52 +02:00
parent af951a243c
commit 9c876166b2

View file

@ -6,6 +6,7 @@
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <cerrno> #include <cerrno>
#include <system_error>
#include <string> #include <string>
#include <memory> #include <memory>
#include <new> #include <new>
@ -288,14 +289,10 @@ OSTD_EXPORT int subprocess::close() {
if (r < 0) { if (r < 0) {
throw process_error{"could not read from pipe"}; throw process_error{"could not read from pipe"};
} else if (r == sizeof(int)) { } else if (r == sizeof(int)) {
char buf[1024]; auto ec = std::system_category().default_error_condition(eno);
if (!strerror_r(eno, buf, sizeof(buf))) {
auto app = appender<std::string>(); auto app = appender<std::string>();
format(app, "could not execute subprocess (%s)", buf); format(app, "could not execute subprocess (%s)", ec.message());
throw process_error{std::move(app.get())}; throw process_error{std::move(app.get())};
} else {
throw process_error{"could not execute subprocess"};
}
} }
} }
reset(); reset();