aboutsummaryrefslogtreecommitdiff
path: root/crates/dinggerd/src/tmux.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/dinggerd/src/tmux.rs')
-rw-r--r--crates/dinggerd/src/tmux.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/dinggerd/src/tmux.rs b/crates/dinggerd/src/tmux.rs
index 48d9544..4e2b370 100644
--- a/crates/dinggerd/src/tmux.rs
+++ b/crates/dinggerd/src/tmux.rs
@@ -59,6 +59,11 @@ fn tmux_binary() -> &'static std::path::Path {
})
}
+/// Run a tmux command against the server dingger watches.
+pub fn run(args: &[&str]) -> Result<String, String> {
+ run_tmux(args)
+}
+
fn run_tmux(args: &[&str]) -> Result<String, String> {
let mut command = Command::new(tmux_binary());
// -u forces UTF-8 mode: without it, tmux mangles format output in
@@ -70,6 +75,11 @@ fn run_tmux(args: &[&str]) -> Result<String, String> {
if let Some(socket) = std::env::var_os("DINGGER_TMUX_SOCKET") {
command.arg("-L").arg(socket);
}
+ // The config a server started by dingger (restore) loads; tests use
+ // /dev/null.
+ if let Some(config) = std::env::var_os("DINGGER_TMUX_CONFIG") {
+ command.arg("-f").arg(config);
+ }
let output = command
.args(args)
.output()