Exit with code 1 (error) if wizard failed. (#96)

* Exit with code 1 (error) if wizard failed.
Should prevent error code 0 after
`creation failed: failed to create database (are you not running as root?).`
and similar errors.

* Switch error messages from stdin to stderr for init_wizard
pull/103/head
George Shuklin 2021-06-02 08:14:54 +03:00 committed by GitHub
parent 8017539f82
commit 0942452950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -236,7 +236,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
match opt.command { match opt.command {
Command::New { opts } => { Command::New { opts } => {
if let Err(e) = initialize::init_wizard(&conf, opts) { if let Err(e) = initialize::init_wizard(&conf, opts) {
println!("{}: {}.", "creation failed".red(), e); eprintln!("{}: {}.", "creation failed".red(), e);
std::process::exit(1);
} }
}, },
Command::Uninstall { interface } => uninstall(&interface, &conf, opt.network)?, Command::Uninstall { interface } => uninstall(&interface, &conf, opt.network)?,