From 486b95e2e301606cab1594e27741bfae805748c1 Mon Sep 17 00:00:00 2001 From: Akbar Fadiansyah <akbarfadi01@gmail.com> Date: Thu, 31 Mar 2022 23:45:15 +1100 Subject: [PATCH] add exit code 1 for invalid number --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index dca2456..7a79816 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use std::process::exit; use clap::Parser; use ansi_term::Colour::Red; use factordb::Number; @@ -26,6 +27,9 @@ fn main() { } } }, - Err(e) => eprintln!( "{} {}", Red.paint("error:"), e) + Err(e) => { + eprintln!("{} {}", Red.paint("error:"), e); + exit(1); + } } } \ No newline at end of file