Fix program not found by fallback to ANSI-escape

This commit is contained in:
Shiroko committed 2022-09-24 01:45:40 +08:00
1 parent e6650dee2c
commit dddaec20fc
1 file changed
+11 -13
+11 -13
View File
@@ -419,19 +419,17 @@ pub struct PrettierOptions {
} }
fn print_console_info(port: u16, config: &CrateConfig, options: PrettierOptions) { fn print_console_info(port: u16, config: &CrateConfig, options: PrettierOptions) {
print!( if let Ok(native_clearseq) = Command::new(if cfg!(target_os = "windows") {
"{}", "cls"
String::from_utf8_lossy( } else {
&Command::new(if cfg!(target_os = "windows") { "clear"
"cls" })
} else { .output() {
"clear" print!("{}", String::from_utf8_lossy(&native_clearseq.stdout));
}) } else {
.output() // Try ANSI-Escape characters
.unwrap() print!("\x1b[2J\x1b[H");
.stdout }
)
);
// for path in &changed { // for path in &changed {
// let path = path // let path = path