aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-06-09 14:10:44 -0400
committerJesse Luehrs <doy@tozt.net>2019-06-09 14:10:44 -0400
commit0eff601814d37012a86e5f02f8a89e928fcfa934 (patch)
treebe6e8267538577bef850263332e838246910ec63
parent3846e0aadda1c7eec96a8004d439a438ed4538a7 (diff)
downloadnbsh-old-0eff601814d37012a86e5f02f8a89e928fcfa934.tar.gz
nbsh-old-0eff601814d37012a86e5f02f8a89e928fcfa934.zip
improve error display a bit
-rw-r--r--src/process.rs15
-rw-r--r--src/repl.rs2
2 files changed, 4 insertions, 13 deletions
diff --git a/src/process.rs b/src/process.rs
index 302c9ca..9d6582c 100644
--- a/src/process.rs
+++ b/src/process.rs
@@ -9,17 +9,8 @@ pub enum Error {
#[snafu(display("failed to open a pty: {}", source))]
OpenPty { source: std::io::Error },
- #[snafu(display(
- "failed to spawn process for {} {}: {}",
- cmd,
- args.join(" "),
- source
- ))]
- SpawnProcess {
- cmd: String,
- args: Vec<String>,
- source: std::io::Error,
- },
+ #[snafu(display("failed to spawn process for `{}`: {}", cmd, source))]
+ SpawnProcess { cmd: String, source: std::io::Error },
#[snafu(display("failed to parse command line '{}': {}", line, source))]
ParserError {
@@ -80,7 +71,7 @@ impl RunningProcess {
let process = std::process::Command::new(cmd.clone())
.args(&args)
.spawn_pty_async(&pty)
- .context(SpawnProcess { cmd, args })?;
+ .context(SpawnProcess { cmd })?;
// TODO: tokio::io::stdin is broken (it's blocking)
// let input = tokio::io::stdin();
diff --git a/src/repl.rs b/src/repl.rs
index 749e0d6..af87a0f 100644
--- a/src/repl.rs
+++ b/src/repl.rs
@@ -63,7 +63,7 @@ pub fn repl() {
let stderr = std::io::stderr();
let mut stderr = stderr.lock();
// panics seem fine for errors during error handling
- write!(stderr, "error: {:?}\r\n", e).unwrap();
+ write!(stderr, "{}\r\n", e).unwrap();
stderr.flush().unwrap();
return Ok((done, false));
}