Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit a48c53ff authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

rust-chg: move set_current_dir() to Locator

This is necessary to run config validation in proper environment.

Differential Revision: https://phab.mercurial-scm.org/D8362
parent 7bf45ed9e25e
......@@ -20,6 +20,7 @@ use tokio_hglib::UnixClient;
use tokio_process::{Child, CommandExt};
use tokio_timer;
use super::clientext::ChgClientExt;
use super::message::ServerSpec;
use super::procutil;
......@@ -80,6 +81,11 @@ impl Locator {
check_server_capabilities(client.server_spec())?;
Ok((loc, client))
})
.and_then(|(loc, client)| {
client
.set_current_dir(&loc.current_dir)
.map(|client| (loc, client))
})
}
/// Spawns new server process and connects to it.
......
......@@ -73,14 +73,12 @@ fn main() {
}
fn run() -> io::Result<i32> {
let current_dir = env::current_dir()?;
let loc = Locator::prepare_from_env()?;
let handler = ChgUiHandler::new();
let (result_tx, result_rx) = oneshot::channel();
let fut = loc
.connect()
.and_then(|(_, client)| client.set_current_dir(current_dir))
.and_then(|client| client.attach_io(io::stdin(), io::stdout(), io::stderr()))
.and_then(|(_, client)| client.attach_io(io::stdin(), io::stdout(), io::stderr()))
.and_then(|client| {
let pid = client.server_spec().process_id.unwrap();
let pgid = client.server_spec().process_group_id;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment