From patchwork Tue Apr 14 16:41:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D8402: rust-chg: move get_umask() call out of run() function From: phabricator X-Patchwork-Id: 46100 Message-Id: <480114c9746581ee3f4f1a19e5aa9cc2@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 14 Apr 2020 16:41:58 +0000 Closed by commit rHG5ac5c25ea97b: rust-chg: move get_umask() call out of run() function (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state "Needs Review". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8402?vs=21037&id=21073 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8402/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8402 AFFECTED FILES rust/chg/src/main.rs CHANGE DETAILS To: yuja, #hg-reviewers, Alphare Cc: mercurial-devel diff --git a/rust/chg/src/main.rs b/rust/chg/src/main.rs --- a/rust/chg/src/main.rs +++ b/rust/chg/src/main.rs @@ -59,15 +59,15 @@ // TODO: add loop detection by $CHGINTERNALMARK - let code = run().unwrap_or_else(|err| { + let umask = unsafe { procutil::get_umask() }; // not thread safe + let code = run(umask).unwrap_or_else(|err| { writeln!(io::stderr(), "chg: abort: {}", err).unwrap_or(()); 255 }); process::exit(code); } -fn run() -> io::Result { - let umask = unsafe { procutil::get_umask() }; // not thread safe +fn run(umask: u32) -> io::Result { let mut loc = Locator::prepare_from_env()?; loc.set_early_args(locator::collect_early_args(env::args_os().skip(1))); let handler = ChgUiHandler::new();