Comments
Patch
@@ -130,3 +130,9 @@
let bytes = s.as_bytes();
Cow::Borrowed(bytes)
}
+
+/// Decode user system bytes to Rust string.
+pub fn local_to_utf8(s: &[u8]) -> Cow<str> {
+ // TODO decode from the user's system //
+ String::from_utf8_lossy(s)
+}
@@ -1,4 +1,5 @@
extern crate log;
+use crate::ui::local_to_utf8;
use crate::ui::Ui;
use clap::App;
use clap::AppSettings;
@@ -358,7 +359,7 @@
) -> ! {
if let (
OnUnsupported::Fallback { executable },
- Err(CommandError::UnsupportedFeature { .. }),
+ Err(CommandError::UnsupportedFeature { message }),
) = (&on_unsupported, &result)
{
let mut args = std::env::args_os();
@@ -374,6 +375,8 @@
));
on_unsupported = OnUnsupported::Abort
} else {
+ log::debug!("falling back (see trace-level log)");
+ log::trace!("{}", local_to_utf8(message));
// `args` is now `argv[1..]` since we’ve already consumed `argv[0]`
let mut command = Command::new(executable_path);
command.args(args);