Better error model

This commit is contained in:
Roey Darwish Dror
2018-12-11 16:43:26 +02:00
parent f23b6435bf
commit 370310948b
16 changed files with 216 additions and 124 deletions

View File

@@ -1,9 +1,10 @@
use super::error::{Error, ErrorKind};
use super::executor::Executor;
use super::terminal::print_separator;
use super::utils::which;
use super::utils::{Check, PathExt};
use directories::BaseDirs;
use failure::Error;
use failure::ResultExt;
use std::env;
use std::io;
use std::os::unix::process::CommandExt;
@@ -41,8 +42,10 @@ fn has_session(tmux: &Path, session_name: &str) -> Result<bool, io::Error> {
fn run_in_session(tmux: &Path, command: &str) -> Result<(), Error> {
Command::new(tmux)
.args(&["new-window", "-a", "-t", "topgrade:1", command])
.spawn()?
.wait()?
.spawn()
.context(ErrorKind::ProcessExecution)?
.wait()
.context(ErrorKind::ProcessExecution)?
.check()?;
Ok(())