From da84ddce7bc0828097c36e46d91e78834a05bf6e Mon Sep 17 00:00:00 2001 From: trilader Date: Tue, 1 Dec 2020 20:36:14 +0100 Subject: [PATCH] Move process launching (and argument substitution) into separate function --- main.cpp | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/main.cpp b/main.cpp index 3bc2f3b..a19dde1 100644 --- a/main.cpp +++ b/main.cpp @@ -297,6 +297,36 @@ void action_select_channel() { } } +bool run_command(const std::vector &cmd, const std::vector> &placeholders={}) { + const size_t cmd_size = cmd.size(); + + if(!cmd_size) + return true; + + const char *cmdline[cmd_size + 1]; + for(size_t c=0; c