Skip to content

Commit

Permalink
fix(core): prevent device status report from being printed during pty…
Browse files Browse the repository at this point in the history
… execution (#23039)
  • Loading branch information
AgentEnder committed Apr 26, 2024
1 parent 8a53892 commit bb2d7f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion packages/nx/src/native/pseudo_terminal/pseudo_terminal.rs
Expand Up @@ -82,7 +82,12 @@ pub fn create_pseudo_terminal() -> napi::Result<PseudoTerminal> {
let quiet = quiet_clone.load(Ordering::Relaxed);
trace!("Quiet: {}", quiet);
if !quiet {
if stdout.write_all(&buf[0..len]).is_err() {
let mut content = String::from_utf8_lossy(&buf[0..len]).to_string();
if content.contains("\x1B[6n") {
trace!("Prevented terminal escape sequence ESC[6n from being printed.");
content = content.replace("\x1B[6n", "");
}
if stdout.write_all(content.as_bytes()).is_err() {
break;
} else {
let _ = stdout.flush();
Expand Down Expand Up @@ -144,8 +149,12 @@ pub fn run_command(
}
let process_killer = child.clone_killer();

trace!("Getting running clone");
let running_clone = pseudo_terminal.running.clone();
trace!("Getting printing_rx clone");
let printing_rx = pseudo_terminal.printing_rx.clone();

trace!("spawning thread to wait for command");
std::thread::spawn(move || {
trace!("Waiting for {}", command);

Expand Down Expand Up @@ -173,9 +182,12 @@ pub fn run_command(
disable_raw_mode().expect("Failed to restore non-raw terminal");
}
exit_to_process_tx.send(exit.to_string()).ok();
} else {
trace!("Error waiting for {}", command);
};
});

trace!("Returning ChildProcess");
Ok(ChildProcess::new(
process_killer,
pseudo_terminal.message_rx.clone(),
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/utils/command-line-utils.ts
Expand Up @@ -39,7 +39,7 @@ export interface NxArgs {
}

export function createOverrides(__overrides_unparsed__: string[] = []) {
let overrides =
let overrides: Record<string, any> =
yargsParser(__overrides_unparsed__, {
configuration: {
'camel-case-expansion': false,
Expand Down

0 comments on commit bb2d7f3

Please sign in to comment.