cli: Improve error when `radicle-node` isn't found

This commit is contained in:
cloudhead 2024-03-22 16:41:51 +01:00
parent 25c7162760
commit 33be2a62da
No known key found for this signature in database
1 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@ use std::fs::{File, OpenOptions};
use std::io::{BufRead, BufReader, Read, Seek, SeekFrom}; use std::io::{BufRead, BufReader, Read, Seek, SeekFrom};
use std::{fs, io, path::Path, process, thread, time}; use std::{fs, io, path::Path, process, thread, time};
use anyhow::anyhow;
use localtime::LocalTime; use localtime::LocalTime;
use radicle::node; use radicle::node;
@ -61,7 +62,8 @@ pub fn start(
.stdin(process::Stdio::null()) .stdin(process::Stdio::null())
.stdout(process::Stdio::from(log.try_clone()?)) .stdout(process::Stdio::from(log.try_clone()?))
.stderr(process::Stdio::from(log)) .stderr(process::Stdio::from(log))
.spawn()?; .spawn()
.map_err(|e| anyhow!("failed to start node process {cmd:?}: {e}"))?;
let pid = term::format::parens(term::format::dim(child.id())); let pid = term::format::parens(term::format::dim(child.id()));
if verbose { if verbose {
@ -98,7 +100,8 @@ pub fn start(
let mut child = process::Command::new(cmd) let mut child = process::Command::new(cmd)
.args(options) .args(options)
.envs(envs) .envs(envs)
.spawn()?; .spawn()
.map_err(|e| anyhow!("failed to start node process {cmd:?}: {e}"))?;
child.wait()?; child.wait()?;
} }