diff options
Diffstat (limited to 'libs/pbd/pbd/system_exec.h')
-rw-r--r-- | libs/pbd/pbd/system_exec.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/pbd/pbd/system_exec.h b/libs/pbd/pbd/system_exec.h index 1232175fec..ce6e5a9c4f 100644 --- a/libs/pbd/pbd/system_exec.h +++ b/libs/pbd/pbd/system_exec.h @@ -42,6 +42,8 @@ #include <string> #include <pthread.h> #include <signal.h> +#include <map> + #ifdef NOPBD /* unit-test outside ardour */ #include <sigc++/bind.h> #include <sigc++/signal.h> @@ -94,6 +96,23 @@ class LIBPBD_API SystemExec * */ SystemExec (std::string c, char ** a); + + /** similar to \ref SystemExec but expects a whole command line, and + * handles some simple escape sequences. + * + * @param command complete command-line to be executed + * @param subs a map of <char, std::string> listing the % substitutions to + * be made. + * + * creates an argv array from the given command string, splitting into + * parameters at spaces. + * "\ " is non-splitting space, "\\" (and "\" at end of command) as "\", + * for "%<char>", <char> is looked up in subs and the corresponding string + * substituted. "%%" (and "%" at end of command) + * returns an argv array suitable for creating a new SystemExec with + */ + SystemExec (std::string command, const std::map<char, std::string> subs); + virtual ~SystemExec (); /** fork and execute the given program @@ -182,6 +201,7 @@ class LIBPBD_API SystemExec int nicelevel; ///< process nice level - defaults to 0 void make_argp(std::string); + void make_argp_escaped(std::string command, const std::map<char, std::string> subs); void make_envp(); char **argp; @@ -198,6 +218,7 @@ class LIBPBD_API SystemExec #else pid_t pid; #endif + void init (); pthread_mutex_t write_lock; int fdin; ///< file-descriptor for writing to child's STDIN. This variable is identical to pin[1] but also used as status check if the stdin pipe is open: <0 means closed. |