equal
deleted
inserted
replaced
57 log::set_max_level(log::LevelFilter::Debug); |
57 log::set_max_level(log::LevelFilter::Debug); |
58 } |
58 } |
59 |
59 |
60 // TODO: add loop detection by $CHGINTERNALMARK |
60 // TODO: add loop detection by $CHGINTERNALMARK |
61 |
61 |
62 let code = run().unwrap_or_else(|err| { |
62 let umask = unsafe { procutil::get_umask() }; // not thread safe |
|
63 let code = run(umask).unwrap_or_else(|err| { |
63 writeln!(io::stderr(), "chg: abort: {}", err).unwrap_or(()); |
64 writeln!(io::stderr(), "chg: abort: {}", err).unwrap_or(()); |
64 255 |
65 255 |
65 }); |
66 }); |
66 process::exit(code); |
67 process::exit(code); |
67 } |
68 } |
68 |
69 |
69 fn run() -> io::Result<i32> { |
70 fn run(umask: u32) -> io::Result<i32> { |
70 let umask = unsafe { procutil::get_umask() }; // not thread safe |
|
71 let mut loc = Locator::prepare_from_env()?; |
71 let mut loc = Locator::prepare_from_env()?; |
72 loc.set_early_args(locator::collect_early_args(env::args_os().skip(1))); |
72 loc.set_early_args(locator::collect_early_args(env::args_os().skip(1))); |
73 let handler = ChgUiHandler::new(); |
73 let handler = ChgUiHandler::new(); |
74 let (result_tx, result_rx) = oneshot::channel(); |
74 let (result_tx, result_rx) = oneshot::channel(); |
75 let fut = loc |
75 let fut = loc |