diff rust/chg/src/main.rs @ 44683:065048e66f32

rust-chg: send client side umask to server This is equivalent to forwardumask() of hgclient.c. Differential Revision: https://phab.mercurial-scm.org/D8382
author Yuya Nishihara <yuya@tcha.org>
date Thu, 04 Oct 2018 22:44:37 +0900
parents 00ac60658654
children 1f5ab1a9363d
line wrap: on
line diff
--- a/rust/chg/src/main.rs	Sun Oct 07 16:14:21 2018 +0900
+++ b/rust/chg/src/main.rs	Thu Oct 04 22:44:37 2018 +0900
@@ -73,6 +73,7 @@
 }
 
 fn run() -> io::Result<i32> {
+    let umask = unsafe { procutil::get_umask() }; // not thread safe
     let mut loc = Locator::prepare_from_env()?;
     loc.set_early_args(locator::collect_early_args(env::args_os().skip(1)));
     let handler = ChgUiHandler::new();
@@ -80,6 +81,7 @@
     let fut = loc
         .connect()
         .and_then(|(_, client)| client.attach_io(io::stdin(), io::stdout(), io::stderr()))
+        .and_then(move |client| client.set_umask(umask))
         .and_then(|client| {
             let pid = client.server_spec().process_id.unwrap();
             let pgid = client.server_spec().process_group_id;