Quote arguments when executing in a shell (#118)

* Quote arguments when executing in a shell

Fixes #107

* Parse quotes in `tmux_arguments`

This makes it possible to encode spaces in arguments. Maybe the config
value should be an array instead?

* Print error causes

Co-authored-by: Thomas Schönauer <37108907+DottoDev@users.noreply.github.com>
This commit is contained in:
Rebecca Turner
2022-11-03 12:46:43 -04:00
committed by GitHub
parent ff66611ec0
commit 55ba2d30c1
8 changed files with 37 additions and 19 deletions

View File

@@ -79,7 +79,7 @@ fn run() -> Result<()> {
if config.run_in_tmux() && env::var("TOPGRADE_INSIDE_TMUX").is_err() {
#[cfg(unix)]
{
tmux::run_in_tmux(config.tmux_arguments());
tmux::run_in_tmux(config.tmux_arguments()?);
}
}
@@ -524,7 +524,10 @@ fn main() {
.is_some());
if !skip_print {
println!("Error: {}", error);
// The `Debug` implementation of `anyhow::Result` prints a multi-line
// error message that includes all the 'causes' added with
// `.with_context(...)` calls.
println!("Error: {:?}", error);
}
exit(1);
}