From: Philipp Gesang Date: Thu, 4 Jan 2018 08:17:10 +0000 (+0100) Subject: add printing helper to pipestream status specification X-Git-Tag: v2.10~1^2~10 X-Git-Url: http://developer.intra2net.com/git/?p=libi2ncommon;a=commitdiff_plain;h=8621037f955fa6615e2252ad5a058eafbb6f5f33 add printing helper to pipestream status specification --- diff --git a/src/pipestream.hxx b/src/pipestream.hxx index f283d87..4b645ef 100644 --- a/src/pipestream.hxx +++ b/src/pipestream.hxx @@ -35,6 +35,8 @@ on this file might be covered by the GNU General Public License. #include #include +#include + struct ExecResult { /** if the program exited normally and returned a return code */ @@ -51,6 +53,17 @@ struct ExecResult /** errormessage if we have one */ std::string error_message; + + inline std::string format (void) const + { + return std::string ("(") + + "(normal_exit " + (this->normal_exit ? "T" : "F") + ") " + "(return_code '" + I2n::to_string ((int)this->return_code) + "') " + "(signal " + (this->terminated_by_signal + ? strsignal (this->signal) + : "") + "))" + ; + }; }; typedef struct ExecResult ExecResult;