comparison rust/chg/src/main.rs @ 44681:00ac60658654

rust-chg: collect server flags from command arguments This is the reimplementation of testsensitiveflag() and setcmdserverargs() of chg.c. Differential Revision: https://phab.mercurial-scm.org/D8380
author Yuya Nishihara <yuya@tcha.org>
date Sun, 07 Oct 2018 16:46:30 +0900
parents 0a2516efc463
children 065048e66f32
comparison
equal deleted inserted replaced
44680:43513444bb88 44681:00ac60658654
7 extern crate futures; 7 extern crate futures;
8 extern crate log; 8 extern crate log;
9 extern crate tokio; 9 extern crate tokio;
10 extern crate tokio_hglib; 10 extern crate tokio_hglib;
11 11
12 use chg::locator::Locator; 12 use chg::locator::{self, Locator};
13 use chg::procutil; 13 use chg::procutil;
14 use chg::{ChgClientExt, ChgUiHandler}; 14 use chg::{ChgClientExt, ChgUiHandler};
15 use futures::sync::oneshot; 15 use futures::sync::oneshot;
16 use std::env; 16 use std::env;
17 use std::io; 17 use std::io;
71 }); 71 });
72 process::exit(code); 72 process::exit(code);
73 } 73 }
74 74
75 fn run() -> io::Result<i32> { 75 fn run() -> io::Result<i32> {
76 let loc = Locator::prepare_from_env()?; 76 let mut loc = Locator::prepare_from_env()?;
77 loc.set_early_args(locator::collect_early_args(env::args_os().skip(1)));
77 let handler = ChgUiHandler::new(); 78 let handler = ChgUiHandler::new();
78 let (result_tx, result_rx) = oneshot::channel(); 79 let (result_tx, result_rx) = oneshot::channel();
79 let fut = loc 80 let fut = loc
80 .connect() 81 .connect()
81 .and_then(|(_, client)| client.attach_io(io::stdin(), io::stdout(), io::stderr())) 82 .and_then(|(_, client)| client.attach_io(io::stdin(), io::stdout(), io::stderr()))