From e72d9c607b8c221fc1f9868770779a2aec133110 Mon Sep 17 00:00:00 2001 From: phiresky Date: Fri, 7 Jun 2019 15:56:04 +0200 Subject: [PATCH] fix error message on missing rg --- src/bin/rga.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bin/rga.rs b/src/bin/rga.rs index 8767612..c134437 100644 --- a/src/bin/rga.rs +++ b/src/bin/rga.rs @@ -1,10 +1,12 @@ use clap::{crate_version, App, Arg}; +use failure::Fallible; use log::*; +use rga::adapters::spawning::map_exe_error; use rga::adapters::*; use std::ffi::OsString; use std::process::Command; -fn main() -> std::io::Result<()> { +fn main() -> Fallible<()> { env_logger::init(); let mut app = App::new(env!("CARGO_PKG_NAME")) .version(crate_version!()) @@ -99,7 +101,8 @@ fn main() -> std::io::Result<()> { .arg("--pre-glob") .arg(format!("*.{{{}}}", extensions)) .args(passthrough_args) - .spawn()?; + .spawn() + .map_err(|e| map_exe_error(e, "rg", "Please make sure you have ripgrep installed."))?; child.wait()?; Ok(())