Skip to content

Commit 51c89c9

Browse files
committed
[WIP] accept input characters for info queries, not just signals
1 parent 1833ee8 commit 51c89c9

File tree

11 files changed

+558
-33
lines changed

11 files changed

+558
-33
lines changed

Cargo.lock

Lines changed: 111 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ config = { version = "0.14.1", default-features = false, features = [
4545
chrono = "0.4.38"
4646
clap = { version = "4.5.22", features = ["derive"] }
4747
console-subscriber = "0.4.1"
48+
crossterm = { version = "0.28.1", features = ["event-stream"] }
4849
dialoguer = "0.11.0"
4950
debug-ignore = "1.0.5"
5051
duct = "0.13.7"
@@ -80,7 +81,7 @@ newtype-uuid = { version = "1.1.3", features = ["v4"] }
8081
nextest-filtering = { version = "0.12.0", path = "nextest-filtering" }
8182
nextest-metadata = { version = "0.12.1", path = "nextest-metadata" }
8283
nextest-workspace-hack = "0.1.0"
83-
nix = { version = "0.29.0", default-features = false, features = ["signal"] }
84+
nix = { version = "0.29.0", default-features = false, features = ["signal", "term"] }
8485
once_cell = "1.20.2"
8586
owo-colors = "4.1.0"
8687
pathdiff = { version = "0.2.3", features = ["camino"] }

cargo-nextest/src/dispatch.rs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use nextest_runner::{
2222
},
2323
double_spawn::DoubleSpawnInfo,
2424
errors::WriteTestListError,
25+
input::InputHandlerKind,
2526
list::{
2627
BinaryList, OutputFormat, RustTestArtifact, SerializableFormat, TestExecuteContext,
2728
TestList,
@@ -986,6 +987,13 @@ struct TestReporterOpts {
986987
#[arg(long, env = "NEXTEST_HIDE_PROGRESS_BAR", value_parser = BoolishValueParser::new())]
987988
hide_progress_bar: bool,
988989

990+
/// Disable handling of input keys from the terminal.
991+
///
992+
/// By default, when running a terminal, nextest accepts the `t` key to dump
993+
/// test information. This flag disables that behavior.
994+
#[arg(long, env = "NEXTEST_NO_INPUT_HANDLER", value_parser = BoolishValueParser::new())]
995+
no_input_handler: bool,
996+
989997
/// Format to use for test results (experimental).
990998
#[arg(
991999
long,
@@ -1780,12 +1788,16 @@ impl App {
17801788
.color
17811789
.should_colorize(supports_color::Stream::Stderr);
17821790

1783-
let mut reporter = reporter_opts
1784-
.to_builder(no_capture, should_colorize)
1785-
.set_verbose(self.base.output.verbose)
1786-
.build(&test_list, &profile, output, structured_reporter);
1791+
let signal_handler = SignalHandlerKind::Standard;
1792+
let input_handler = if reporter_opts.no_input_handler {
1793+
InputHandlerKind::Noop
1794+
} else {
1795+
// This means that the input handler determines whether it should be
1796+
// enabled.
1797+
InputHandlerKind::Standard
1798+
};
17871799

1788-
let handler = SignalHandlerKind::Standard;
1800+
// Make the runner.
17891801
let runner_builder = match runner_opts.to_builder(cap_strat) {
17901802
Some(runner_builder) => runner_builder,
17911803
None => {
@@ -1798,11 +1810,18 @@ impl App {
17981810
&test_list,
17991811
&profile,
18001812
cli_args,
1801-
handler,
1813+
signal_handler,
1814+
input_handler,
18021815
double_spawn.clone(),
18031816
target_runner.clone(),
18041817
)?;
18051818

1819+
// Make the reporter.
1820+
let mut reporter = reporter_opts
1821+
.to_builder(no_capture, should_colorize)
1822+
.set_verbose(self.base.output.verbose)
1823+
.build(&test_list, &profile, output, structured_reporter);
1824+
18061825
configure_handle_inheritance(no_capture)?;
18071826
let run_stats = runner.try_execute(|event| {
18081827
// Write and flush the event.

nextest-runner/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ cargo_metadata.workspace = true
2525
config.workspace = true
2626
cfg-if.workspace = true
2727
chrono.workspace = true
28+
crossterm.workspace = true
2829
debug-ignore.workspace = true
2930
duct.workspace = true
3031
future-queue.workspace = true
@@ -69,6 +70,7 @@ thiserror.workspace = true
6970
# For parsing of .cargo/config.toml files
7071
tokio = { workspace = true, features = [
7172
"fs",
73+
"io-std",
7274
"io-util",
7375
"macros",
7476
"process",

0 commit comments

Comments
 (0)