11 use std::{env, path::PathBuf};
14 use once_cell::sync::Lazy;
17 error::{Error, Result},
19 logger::{shutdown_logger_and_wait, spawn_logger_thread},
20 QuestionAction, QuestionPolicy,
24 // Used in BufReader and BufWriter to perform less syscalls
25 const BUFFER_CAPACITY: usize = 1024 * 32;
27 /// Current directory or empty directory
28 static CURRENT_DIRECTORY: Lazy<PathBuf> = Lazy::new(|| env::current_dir().unwrap_or_default());
30 /// The status code returned from `ouch` on error
31 pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE;
34 spawn_logger_thread();
36 shutdown_logger_and_wait();
38 if let Err(err) = result {
40 std::process::exit(EXIT_FAILURE);
44 fn run() -> Result<()> {
45 let (args, skip_questions_positively, file_visibility_policy) = CliArgs::parse_and_validate_args()?;
46 commands::run(args, skip_questions_positively, file_visibility_policy)