##// END OF EJS Templates
rhg: signal when falling back in logs...
Raphaël Gomès -
r49622:f19be290 default
parent child Browse files
Show More
@@ -1,6 +1,6 b''
1 extern crate log;
1 extern crate log;
2 use crate::error::CommandError;
2 use crate::error::CommandError;
3 use crate::ui::Ui;
3 use crate::ui::{local_to_utf8, Ui};
4 use clap::App;
4 use clap::App;
5 use clap::AppSettings;
5 use clap::AppSettings;
6 use clap::Arg;
6 use clap::Arg;
@@ -383,7 +383,7 b' fn exit('
383 ) -> ! {
383 ) -> ! {
384 if let (
384 if let (
385 OnUnsupported::Fallback { executable },
385 OnUnsupported::Fallback { executable },
386 Err(CommandError::UnsupportedFeature { .. }),
386 Err(CommandError::UnsupportedFeature { message }),
387 ) = (&on_unsupported, &result)
387 ) = (&on_unsupported, &result)
388 {
388 {
389 let mut args = std::env::args_os();
389 let mut args = std::env::args_os();
@@ -413,6 +413,8 b' fn exit('
413 ));
413 ));
414 on_unsupported = OnUnsupported::Abort
414 on_unsupported = OnUnsupported::Abort
415 } else {
415 } else {
416 log::debug!("falling back (see trace-level log)");
417 log::trace!("{}", local_to_utf8(message));
416 // `args` is now `argv[1..]` since we’ve already consumed
418 // `args` is now `argv[1..]` since we’ve already consumed
417 // `argv[0]`
419 // `argv[0]`
418 let mut command = Command::new(executable_path);
420 let mut command = Command::new(executable_path);
@@ -219,6 +219,12 b' pub fn utf8_to_local(s: &str) -> Cow<[u8'
219 Cow::Borrowed(bytes)
219 Cow::Borrowed(bytes)
220 }
220 }
221
221
222 /// Decode user system bytes to Rust string.
223 pub fn local_to_utf8(s: &[u8]) -> Cow<str> {
224 // TODO decode from the user's system
225 String::from_utf8_lossy(s)
226 }
227
222 /// Should formatted output be used?
228 /// Should formatted output be used?
223 ///
229 ///
224 /// Note: rhg does not have the formatter mechanism yet,
230 /// Note: rhg does not have the formatter mechanism yet,
General Comments 0
You need to be logged in to leave comments. Login now