|
|
|
@@ -62,6 +62,7 @@
|
|
|
|
|
#include <assert.h> // assert
|
|
|
|
|
#include <sys/types.h> // kill
|
|
|
|
|
#include <signal.h> // kill
|
|
|
|
|
#include <cstdlib> // exit
|
|
|
|
|
|
|
|
|
|
//=========================================================== ExecutionFailedExc
|
|
|
|
|
|
|
|
|
@@ -246,11 +247,13 @@ mrw::Exec& mrw::Exec::execute(bool exc) throw(std::exception) {
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
mrw::Exec& mrw::Exec::execute(const std::string& input, bool exc)
|
|
|
|
|
throw(std::exception) {
|
|
|
|
|
#ifdef SSIZE_MAX
|
|
|
|
|
/// @c input length must be smaller than @c SSIZE_MAX.
|
|
|
|
|
/// I'll only add support for longer strings upon request.
|
|
|
|
|
assert(input.size()<=SSIZE_MAX &&
|
|
|
|
|
"sdin input exeeds C library limit in mrw::Exec "
|
|
|
|
|
"please contact the author of the library");
|
|
|
|
|
#endif
|
|
|
|
|
/** This method calls @c fork, sets up a pipe connection to pass @c
|
|
|
|
|
stdin, @c stdout and @c stderr between the child process and the
|
|
|
|
|
parent process using mrw::Pipe and calls @c execvp to execute
|
|
|
|
@@ -471,11 +474,13 @@ std::pair<std::string, std::string>
|
|
|
|
|
mrw::PartialExec::read(const std::string& input, bool exc)
|
|
|
|
|
throw(std::exception) {
|
|
|
|
|
std::pair<std::string, std::string> output;
|
|
|
|
|
#ifdef SSIZE_MAX
|
|
|
|
|
/** @note @c input length must be smaller than @c SSIZE_MAX.
|
|
|
|
|
I'll only add support for longer strings upon request. */
|
|
|
|
|
assert(input.size()<=SSIZE_MAX &&
|
|
|
|
|
"sdin input exeeds C library limit in mrw::Exec "
|
|
|
|
|
"please contact the author of the library");
|
|
|
|
|
#endif
|
|
|
|
|
/** @warning After calling finish(), it is forbidden to pass
|
|
|
|
|
any @c input string, it must then always be empty,
|
|
|
|
|
because the pipe is already closed! */
|
|
|
|
|