##// END OF EJS Templates
rust-chg: update name of the server process...
Yuya Nishihara -
r45175:80d6e341 default
parent child Browse files
Show More
@@ -42,6 +42,11 b' where'
42 I: IntoIterator<Item = (P, P)>,
42 I: IntoIterator<Item = (P, P)>,
43 P: AsRef<OsStr>;
43 P: AsRef<OsStr>;
44
44
45 /// Changes the process title of the server.
46 fn set_process_name<P>(self, name: P) -> OneShotRequest<C>
47 where
48 P: AsRef<OsStr>;
49
45 /// Changes the umask of the server process.
50 /// Changes the umask of the server process.
46 fn set_umask(self, mask: u32) -> OneShotRequest<C>;
51 fn set_umask(self, mask: u32) -> OneShotRequest<C>;
47
52
@@ -94,6 +99,13 b' where'
94 OneShotRequest::start_with_args(self, b"setenv", message::pack_env_vars_os(vars))
99 OneShotRequest::start_with_args(self, b"setenv", message::pack_env_vars_os(vars))
95 }
100 }
96
101
102 fn set_process_name<P>(self, name: P) -> OneShotRequest<C>
103 where
104 P: AsRef<OsStr>,
105 {
106 OneShotRequest::start_with_args(self, b"setprocname", name.as_ref().as_bytes())
107 }
108
97 fn set_umask(self, mask: u32) -> OneShotRequest<C> {
109 fn set_umask(self, mask: u32) -> OneShotRequest<C> {
98 let mut args = BytesMut::with_capacity(mem::size_of_val(&mask));
110 let mut args = BytesMut::with_capacity(mem::size_of_val(&mask));
99 args.put_u32_be(mask);
111 args.put_u32_be(mask);
@@ -196,6 +196,17 b' impl Locator {'
196 Ok((loc, client))
196 Ok((loc, client))
197 })
197 })
198 .and_then(|(loc, client)| {
198 .and_then(|(loc, client)| {
199 // It's purely optional, and the server might not support this command.
200 if client.server_spec().capabilities.contains("setprocname") {
201 let fut = client
202 .set_process_name(format!("chg[worker/{}]", loc.process_id))
203 .map(|client| (loc, client));
204 Either::A(fut)
205 } else {
206 Either::B(future::ok((loc, client)))
207 }
208 })
209 .and_then(|(loc, client)| {
199 client
210 client
200 .set_current_dir(&loc.current_dir)
211 .set_current_dir(&loc.current_dir)
201 .map(|client| (loc, client))
212 .map(|client| (loc, client))
General Comments 0
You need to be logged in to leave comments. Login now