##// END OF EJS Templates
rust-chg: send client-side environment variables to server...
Yuya Nishihara -
r45165:97e6d435 default
parent child Browse files
Show More
@@ -33,6 +33,12 b' where'
33 where
33 where
34 P: AsRef<Path>;
34 P: AsRef<Path>;
35
35
36 /// Updates the environment variables of the server.
37 fn set_env_vars_os<I, P>(self, vars: I) -> OneShotRequest<C>
38 where
39 I: IntoIterator<Item = (P, P)>,
40 P: AsRef<OsStr>;
41
36 /// Runs the specified Mercurial command with cHg extension.
42 /// Runs the specified Mercurial command with cHg extension.
37 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
43 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
38 where
44 where
@@ -61,6 +67,14 b' where'
61 OneShotRequest::start_with_args(self, b"chdir", dir.as_ref().as_os_str().as_bytes())
67 OneShotRequest::start_with_args(self, b"chdir", dir.as_ref().as_os_str().as_bytes())
62 }
68 }
63
69
70 fn set_env_vars_os<I, P>(self, vars: I) -> OneShotRequest<C>
71 where
72 I: IntoIterator<Item = (P, P)>,
73 P: AsRef<OsStr>,
74 {
75 OneShotRequest::start_with_args(self, b"setenv", message::pack_env_vars_os(vars))
76 }
77
64 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
78 fn run_command_chg<I, P, H>(self, handler: H, args: I) -> ChgRunCommand<C, H>
65 where
79 where
66 I: IntoIterator<Item = P>,
80 I: IntoIterator<Item = P>,
@@ -24,7 +24,7 b' use super::clientext::ChgClientExt;'
24 use super::message::ServerSpec;
24 use super::message::ServerSpec;
25 use super::procutil;
25 use super::procutil;
26
26
27 const REQUIRED_SERVER_CAPABILITIES: &[&str] = &["attachio", "chdir", "runcommand"];
27 const REQUIRED_SERVER_CAPABILITIES: &[&str] = &["attachio", "chdir", "runcommand", "setenv"];
28
28
29 /// Helper to connect to and spawn a server process.
29 /// Helper to connect to and spawn a server process.
30 #[derive(Clone, Debug)]
30 #[derive(Clone, Debug)]
@@ -86,6 +86,11 b' impl Locator {'
86 .set_current_dir(&loc.current_dir)
86 .set_current_dir(&loc.current_dir)
87 .map(|client| (loc, client))
87 .map(|client| (loc, client))
88 })
88 })
89 .and_then(|(loc, client)| {
90 client
91 .set_env_vars_os(loc.env_vars.iter().cloned())
92 .map(|client| (loc, client))
93 })
89 }
94 }
90
95
91 /// Spawns new server process and connects to it.
96 /// Spawns new server process and connects to it.
General Comments 0
You need to be logged in to leave comments. Login now