use exitfailure for cleaner fail output

pull/16/head
phiresky 5 years ago
parent 57115923af
commit 9201add7e0

@ -36,7 +36,7 @@ before_deploy: ci/before_deploy.sh
deploy:
provider: releases
file_glob: true
file: deployment/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz
file: deployment/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.*
skip_cleanup: true
on:
condition: $TRAVIS_RUST_VERSION = nightly

10
Cargo.lock generated

@ -305,6 +305,14 @@ dependencies = [
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "exitfailure"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure"
version = "0.1.5"
@ -939,6 +947,7 @@ dependencies = [
"encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs_io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"exitfailure 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1425,6 +1434,7 @@ dependencies = [
"checksum encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)" = "4155785c79f2f6701f185eb2e6b4caf0555ec03477cb4c70db67b465311620ed"
"checksum encoding_rs_io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9619ee7a2bf4e777e020b95c1439abaf008f8ea8041b78a0552c4f1bcf4df32c"
"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a"
"checksum exitfailure 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ff5bd832af37f366c6c194d813a11cd90ac484f124f079294f28e357ae40515"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
"checksum fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"

@ -44,3 +44,4 @@ structopt = "0.2.16"
paste = "0.1.5"
tempfile = "3.0.8"
glob = "0.3.0"
exitfailure = "0.5.1"

@ -51,7 +51,11 @@ mk_tarball() {
# cp "$cargo_out_dir"/{rg.bash,rg.fish,_rg.ps1} "$staging/complete/"
# cp complete/_rg "$staging/complete/"
(cd "$tmpdir" && tar czf "$out_dir/$name.tar.gz" "$name")
if is_windows; then
(cd "$tmpdir" && zip -r "$out_dir/$name.zip" "$name")
else
(cd "$tmpdir" && tar czf "$out_dir/$name.tar.gz" "$name")
fi
rm -rf "$tmpdir"
}

@ -5,7 +5,7 @@ use ripgrep_all as rga;
use std::fs::File;
fn main() -> Fallible<()> {
fn main() -> Result<(), exitfailure::ExitFailure> {
env_logger::init();
let mut arg_arr: Vec<std::ffi::OsString> = std::env::args_os().collect();
let last = arg_arr.pop().expect("No filename specified");
@ -32,12 +32,6 @@ fn main() -> Fallible<()> {
archive_recursion_depth: 0,
config: PreprocConfig { cache, args: &args },
};
match rga_preproc(ai) {
Ok(()) => Ok(()),
Err(e) => {
eprintln!("preproc error: {}", e);
std::process::exit(1);
}
}
rga_preproc(ai)?;
Ok(())
}

@ -8,7 +8,7 @@ use structopt::StructOpt;
use std::process::Command;
fn main() -> Fallible<()> {
fn main() -> Result<(), exitfailure::ExitFailure> {
env_logger::init();
let (args, passthrough_args) = split_args()?;

@ -2,8 +2,7 @@ use crate::adapters::*;
use crate::args::RgaArgs;
use crate::matching::*;
use crate::CachingWriter;
use failure::Fallible;
use failure::{format_err, Error};
use failure::*;
use log::*;
use path_clean::PathClean;
use std::convert::TryInto;

Loading…
Cancel
Save