fix(core): skip vt100 parsing if tui disabled (#31010)
This commit is contained in:
parent
7059d6f17b
commit
6e1f304898
@ -109,17 +109,21 @@ impl PseudoTerminal {
|
|||||||
let quiet = quiet_clone.load(Ordering::Relaxed);
|
let quiet = quiet_clone.load(Ordering::Relaxed);
|
||||||
trace!("Quiet: {}", quiet);
|
trace!("Quiet: {}", quiet);
|
||||||
debug!("Read {} bytes", len);
|
debug!("Read {} bytes", len);
|
||||||
|
if is_within_nx_tui {
|
||||||
if let Ok(mut parser) = parser_clone.write() {
|
if let Ok(mut parser) = parser_clone.write() {
|
||||||
|
if is_within_nx_tui {
|
||||||
|
trace!("Processing data via vt100 for use in tui");
|
||||||
parser.process(&buf[..len]);
|
parser.process(&buf[..len]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !quiet {
|
if !quiet {
|
||||||
let mut logged_interrupted_error = false;
|
let mut logged_interrupted_error = false;
|
||||||
|
|
||||||
let mut content = String::from_utf8_lossy(&buf[0..len]).to_string();
|
let mut content = String::from_utf8_lossy(&buf[0..len]).to_string();
|
||||||
if content.contains("\x1B[6n") {
|
if content.contains("\x1B[6n") {
|
||||||
trace!(
|
trace!("Prevented terminal escape sequence ESC[6n from being printed.");
|
||||||
"Prevented terminal escape sequence ESC[6n from being printed."
|
|
||||||
);
|
|
||||||
content = content.replace("\x1B[6n", "");
|
content = content.replace("\x1B[6n", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +148,6 @@ impl PseudoTerminal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _ = stdout.flush();
|
let _ = stdout.flush();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
debug!("Failed to lock parser");
|
debug!("Failed to lock parser");
|
||||||
}
|
}
|
||||||
@ -211,10 +214,13 @@ impl PseudoTerminal {
|
|||||||
let command_info = format!("> {}\n\n\r", command_label.unwrap_or(command));
|
let command_info = format!("> {}\n\n\r", command_label.unwrap_or(command));
|
||||||
self.stdout_tx.send(command_info.clone()).ok();
|
self.stdout_tx.send(command_info.clone()).ok();
|
||||||
|
|
||||||
|
if self.is_within_nx_tui {
|
||||||
self.parser
|
self.parser
|
||||||
.write()
|
.write()
|
||||||
.expect("Failed to acquire parser write lock")
|
.expect("Failed to acquire parser write lock")
|
||||||
.process(command_info.as_bytes());
|
.process(command_info.as_bytes());
|
||||||
|
}
|
||||||
|
|
||||||
trace!("Running {}", command_clone);
|
trace!("Running {}", command_clone);
|
||||||
let mut child = pair.slave.spawn_command(cmd)?;
|
let mut child = pair.slave.spawn_command(cmd)?;
|
||||||
self.running.store(true, Ordering::SeqCst);
|
self.running.store(true, Ordering::SeqCst);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user