From def8cb507114c4fd7bf3fb51051be4a6b34816f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 12 Jul 2018 11:49:12 +0300 Subject: [PATCH] Add C++ helper for SSH output The ssh_output function returns a string and takes a std::string as the ssh command parameter. --- maxscale-system-test/nodes.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/maxscale-system-test/nodes.h b/maxscale-system-test/nodes.h index 83be49c0f..bdccbabc0 100644 --- a/maxscale-system-test/nodes.h +++ b/maxscale-system-test/nodes.h @@ -117,6 +117,16 @@ public: char *ssh_node_output_f(int node, bool sudo, int* exit_code, const char* format, ...) mxb_attribute((format(printf, 5, 6))); char *ssh_node_output(int node, const char *ssh, bool sudo, int *exit_code); + // Simplified C++ version + std::string ssh_output(std::string ssh, int node = 0, bool sudo = true) + { + int rc; + char* out = ssh_node_output(node, ssh.c_str(), sudo, &rc); + std::string rval(out); + free(out); + return rval; + } + /** * @brief executes shell command on the node using ssh * @param index number of the node (index)