From 8621037f955fa6615e2252ad5a058eafbb6f5f33 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 4 Jan 2018 09:17:10 +0100 Subject: [PATCH] add printing helper to pipestream status specification --- src/pipestream.hxx | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) 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; -- 1.7.1