##// END OF EJS Templates
rust-chg: move set_current_dir() to Locator...
Yuya Nishihara -
r45163:0a2516ef default
parent child Browse files
Show More
@@ -20,6 +20,7 b' use tokio_hglib::UnixClient;'
20 use tokio_process::{Child, CommandExt};
20 use tokio_process::{Child, CommandExt};
21 use tokio_timer;
21 use tokio_timer;
22
22
23 use super::clientext::ChgClientExt;
23 use super::message::ServerSpec;
24 use super::message::ServerSpec;
24 use super::procutil;
25 use super::procutil;
25
26
@@ -80,6 +81,11 b' impl Locator {'
80 check_server_capabilities(client.server_spec())?;
81 check_server_capabilities(client.server_spec())?;
81 Ok((loc, client))
82 Ok((loc, client))
82 })
83 })
84 .and_then(|(loc, client)| {
85 client
86 .set_current_dir(&loc.current_dir)
87 .map(|client| (loc, client))
88 })
83 }
89 }
84
90
85 /// Spawns new server process and connects to it.
91 /// Spawns new server process and connects to it.
@@ -73,14 +73,12 b' fn main() {'
73 }
73 }
74
74
75 fn run() -> io::Result<i32> {
75 fn run() -> io::Result<i32> {
76 let current_dir = env::current_dir()?;
77 let loc = Locator::prepare_from_env()?;
76 let loc = Locator::prepare_from_env()?;
78 let handler = ChgUiHandler::new();
77 let handler = ChgUiHandler::new();
79 let (result_tx, result_rx) = oneshot::channel();
78 let (result_tx, result_rx) = oneshot::channel();
80 let fut = loc
79 let fut = loc
81 .connect()
80 .connect()
82 .and_then(|(_, client)| client.set_current_dir(current_dir))
81 .and_then(|(_, client)| client.attach_io(io::stdin(), io::stdout(), io::stderr()))
83 .and_then(|client| client.attach_io(io::stdin(), io::stdout(), io::stderr()))
84 .and_then(|client| {
82 .and_then(|client| {
85 let pid = client.server_spec().process_id.unwrap();
83 let pid = client.server_spec().process_id.unwrap();
86 let pgid = client.server_spec().process_group_id;
84 let pgid = client.server_spec().process_group_id;
General Comments 0
You need to be logged in to leave comments. Login now