fix(core): don't display fork script path in tui (#30970)
## Current Behavior The tui displays the path to the fork script in the pty pane ## Expected Behavior The tui displays a command that would be "close enough" to what is being ran in the pty pane ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
3877a43a47
commit
958985a182
4
packages/nx/src/native/index.d.ts
vendored
4
packages/nx/src/native/index.d.ts
vendored
@ -89,12 +89,12 @@ export declare class RunningTasksService {
|
||||
|
||||
export declare class RustPseudoTerminal {
|
||||
constructor()
|
||||
runCommand(command: string, commandDir?: string | undefined | null, jsEnv?: Record<string, string> | undefined | null, execArgv?: Array<string> | undefined | null, quiet?: boolean | undefined | null, tty?: boolean | undefined | null): ChildProcess
|
||||
runCommand(command: string, commandDir?: string | undefined | null, jsEnv?: Record<string, string> | undefined | null, execArgv?: Array<string> | undefined | null, quiet?: boolean | undefined | null, tty?: boolean | undefined | null, commandLabel?: string | undefined | null): ChildProcess
|
||||
/**
|
||||
* This allows us to run a pseudoterminal with a fake node ipc channel
|
||||
* this makes it possible to be backwards compatible with the old implementation
|
||||
*/
|
||||
fork(id: string, forkScript: string, pseudoIpcPath: string, commandDir: string | undefined | null, jsEnv: Record<string, string> | undefined | null, execArgv: Array<string> | undefined | null, quiet: boolean): ChildProcess
|
||||
fork(id: string, forkScript: string, pseudoIpcPath: string, commandDir: string | undefined | null, jsEnv: Record<string, string> | undefined | null, execArgv: Array<string> | undefined | null, quiet: boolean, commandLabel?: string | undefined | null): ChildProcess
|
||||
}
|
||||
|
||||
export declare class TaskDetails {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use tracing::trace;
|
||||
use watchexec::command;
|
||||
|
||||
use super::child_process::ChildProcess;
|
||||
use super::os;
|
||||
@ -31,9 +32,17 @@ impl RustPseudoTerminal {
|
||||
exec_argv: Option<Vec<String>>,
|
||||
quiet: Option<bool>,
|
||||
tty: Option<bool>,
|
||||
command_label: Option<String>,
|
||||
) -> napi::Result<ChildProcess> {
|
||||
self.pseudo_terminal
|
||||
.run_command(command, command_dir, js_env, exec_argv, quiet, tty)
|
||||
self.pseudo_terminal.run_command(
|
||||
command,
|
||||
command_dir,
|
||||
js_env,
|
||||
exec_argv,
|
||||
quiet,
|
||||
tty,
|
||||
command_label,
|
||||
)
|
||||
}
|
||||
|
||||
/// This allows us to run a pseudoterminal with a fake node ipc channel
|
||||
@ -48,6 +57,7 @@ impl RustPseudoTerminal {
|
||||
js_env: Option<HashMap<String, String>>,
|
||||
exec_argv: Option<Vec<String>>,
|
||||
quiet: bool,
|
||||
command_label: Option<String>,
|
||||
) -> napi::Result<ChildProcess> {
|
||||
let command = format!(
|
||||
"node {} {} {}",
|
||||
@ -64,6 +74,7 @@ impl RustPseudoTerminal {
|
||||
exec_argv,
|
||||
Some(quiet),
|
||||
Some(true),
|
||||
command_label,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,9 +32,17 @@ impl RustPseudoTerminal {
|
||||
exec_argv: Option<Vec<String>>,
|
||||
quiet: Option<bool>,
|
||||
tty: Option<bool>,
|
||||
command_label: Option<String>,
|
||||
) -> napi::Result<ChildProcess> {
|
||||
self.pseudo_terminal
|
||||
.run_command(command, command_dir, js_env, exec_argv, quiet, tty)
|
||||
self.pseudo_terminal.run_command(
|
||||
command,
|
||||
command_dir,
|
||||
js_env,
|
||||
exec_argv,
|
||||
quiet,
|
||||
tty,
|
||||
command_label,
|
||||
)
|
||||
}
|
||||
|
||||
/// This allows us to run a pseudoterminal with a fake node ipc channel
|
||||
@ -49,6 +57,7 @@ impl RustPseudoTerminal {
|
||||
js_env: Option<HashMap<String, String>>,
|
||||
exec_argv: Option<Vec<String>>,
|
||||
quiet: bool,
|
||||
command_label: Option<String>,
|
||||
) -> napi::Result<ChildProcess> {
|
||||
let command = format!(
|
||||
"node {} {} {}",
|
||||
@ -65,6 +74,7 @@ impl RustPseudoTerminal {
|
||||
exec_argv,
|
||||
Some(quiet),
|
||||
Some(true),
|
||||
command_label,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +181,7 @@ impl PseudoTerminal {
|
||||
exec_argv: Option<Vec<String>>,
|
||||
quiet: Option<bool>,
|
||||
tty: Option<bool>,
|
||||
command_label: Option<String>,
|
||||
) -> napi::Result<ChildProcess> {
|
||||
let command_dir = get_directory(command_dir)?;
|
||||
|
||||
@ -206,15 +207,15 @@ impl PseudoTerminal {
|
||||
|
||||
let (exit_to_process_tx, exit_to_process_rx) = bounded(1);
|
||||
|
||||
let command_info = format!("> {}\n\n\r", command);
|
||||
let command_clone = command.clone();
|
||||
let command_info = format!("> {}\n\n\r", command_label.unwrap_or(command));
|
||||
self.stdout_tx.send(command_info.clone()).ok();
|
||||
|
||||
self.parser
|
||||
.write()
|
||||
.expect("Failed to acquire parser write lock")
|
||||
.process(command_info.as_bytes());
|
||||
|
||||
trace!("Running {}", command);
|
||||
trace!("Running {}", command_clone);
|
||||
let mut child = pair.slave.spawn_command(cmd)?;
|
||||
self.running.store(true, Ordering::SeqCst);
|
||||
|
||||
@ -234,11 +235,11 @@ impl PseudoTerminal {
|
||||
|
||||
trace!("spawning thread to wait for command");
|
||||
std::thread::spawn(move || {
|
||||
trace!("Waiting for {}", command);
|
||||
trace!("Waiting for {}", command_clone);
|
||||
|
||||
let res = child.wait();
|
||||
if let Ok(exit) = res {
|
||||
trace!("{} Exited", command);
|
||||
trace!("{} Exited", command_clone);
|
||||
// This mitigates the issues with ConPTY on windows and makes it work.
|
||||
running_clone.store(false, Ordering::SeqCst);
|
||||
if cfg!(windows) {
|
||||
@ -261,7 +262,7 @@ impl PseudoTerminal {
|
||||
}
|
||||
exit_to_process_tx.send(exit.to_string()).ok();
|
||||
} else {
|
||||
trace!("Error waiting for {}", command);
|
||||
trace!("Error waiting for {}", command_clone);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@ -203,6 +203,7 @@ export class ForkedProcessTaskRunner {
|
||||
execArgv: process.execArgv,
|
||||
jsEnv: env,
|
||||
quiet: !streamOutput,
|
||||
commandLabel: `nx run ${task.id}`,
|
||||
});
|
||||
|
||||
p.send({
|
||||
|
||||
@ -106,11 +106,13 @@ export class PseudoTerminal {
|
||||
execArgv,
|
||||
jsEnv,
|
||||
quiet,
|
||||
commandLabel,
|
||||
}: {
|
||||
cwd?: string;
|
||||
execArgv?: string[];
|
||||
jsEnv?: Record<string, string>;
|
||||
quiet?: boolean;
|
||||
commandLabel?: string;
|
||||
}
|
||||
) {
|
||||
if (!this.initialized) {
|
||||
@ -125,7 +127,8 @@ export class PseudoTerminal {
|
||||
cwd,
|
||||
jsEnv,
|
||||
execArgv,
|
||||
quiet
|
||||
quiet,
|
||||
commandLabel
|
||||
),
|
||||
id,
|
||||
this.pseudoIPC
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user