Add support for global prep commands (#977)

This commit is contained in:
pgrunzjr
2023-03-27 11:02:20 -05:00
committed by GitHub
parent c2fba6f651
commit 8c86baf627
7 changed files with 152 additions and 24 deletions

View File

@@ -12,20 +12,13 @@
#include <boost/process.hpp>
#include "config.h"
#include "utility.h"
namespace proc {
using file_t = util::safe_ptr_v2<FILE, int, fclose>;
struct cmd_t {
cmd_t(std::string &&do_cmd, std::string &&undo_cmd) : do_cmd(std::move(do_cmd)), undo_cmd(std::move(undo_cmd)) {}
explicit cmd_t(std::string &&do_cmd) : do_cmd(std::move(do_cmd)) {}
std::string do_cmd;
// Executed when proc_t has finished running, meant to reverse 'do_cmd' if applicable
std::string undo_cmd;
};
typedef config::prep_cmd_t cmd_t;
/*
* pre_cmds -- guaranteed to be executed unless any of the commands fail.
* detached -- commands detached from Sunshine