diff --git a/buck2_audit/src/lib.rs b/buck2_audit/src/lib.rs index 4e619e30f3835..61a9276f93ede 100644 --- a/buck2_audit/src/lib.rs +++ b/buck2_audit/src/lib.rs @@ -143,7 +143,7 @@ impl StreamingCommand for AuditCommand { context: Some(context), serialized_opts: serialized, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(self.console_opts()), ) .await??; ExitResult::success() diff --git a/buck2_client/src/commands/aquery.rs b/buck2_client/src/commands/aquery.rs index d2e5fca3e66c3..2e225b6bc6337 100644 --- a/buck2_client/src/commands/aquery.rs +++ b/buck2_client/src/commands/aquery.rs @@ -79,7 +79,7 @@ impl StreamingCommand for AqueryCommand { output_attributes, unstable_output_format, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await??; diff --git a/buck2_client/src/commands/build.rs b/buck2_client/src/commands/build.rs index aeee54f4bd935..32d3142ada41e 100644 --- a/buck2_client/src/commands/build.rs +++ b/buck2_client/src/commands/build.rs @@ -245,7 +245,7 @@ impl StreamingCommand for BuildCommand { build_opts: Some(self.build_opts.to_proto()), final_artifact_materializations: self.materializations.to_proto() as i32, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await; let success = match &result { diff --git a/buck2_client/src/commands/bxl.rs b/buck2_client/src/commands/bxl.rs index 1621c7570c472..3ffac34bbf753 100644 --- a/buck2_client/src/commands/bxl.rs +++ b/buck2_client/src/commands/bxl.rs @@ -72,7 +72,7 @@ impl StreamingCommand for BxlCommand { build_opts: Some(self.build_opts.to_proto()), final_artifact_materializations: self.materializations.to_proto() as i32, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await; let success = match &result { diff --git a/buck2_client/src/commands/cquery.rs b/buck2_client/src/commands/cquery.rs index ae7227c647fe0..7e91fe8d87e1b 100644 --- a/buck2_client/src/commands/cquery.rs +++ b/buck2_client/src/commands/cquery.rs @@ -128,7 +128,7 @@ impl StreamingCommand for CqueryCommand { target_call_stacks: self.query_common.target_call_stacks, correct_owner, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await??; diff --git a/buck2_client/src/commands/debug/materialize.rs b/buck2_client/src/commands/debug/materialize.rs index 15cebe6b2b78f..07513c989e218 100644 --- a/buck2_client/src/commands/debug/materialize.rs +++ b/buck2_client/src/commands/debug/materialize.rs @@ -60,7 +60,7 @@ impl StreamingCommand for MaterializeCommand { context: Some(context), paths: self.paths, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await??; diff --git a/buck2_client/src/commands/install.rs b/buck2_client/src/commands/install.rs index 9bcb61d953379..45d42ad4eeb32 100644 --- a/buck2_client/src/commands/install.rs +++ b/buck2_client/src/commands/install.rs @@ -68,7 +68,7 @@ impl StreamingCommand for InstallCommand { build_opts: Some(self.build_opts.to_proto()), installer_run_args: self.extra_run_args, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await; let console = self.console_opts.final_console(); diff --git a/buck2_client/src/commands/profile.rs b/buck2_client/src/commands/profile.rs index a7c3b7938f6d9..c85c6dc64cfde 100644 --- a/buck2_client/src/commands/profile.rs +++ b/buck2_client/src/commands/profile.rs @@ -166,7 +166,8 @@ impl StreamingCommand for ProfileSubcommand { action: self.action.into(), recursive: self.opts.recursive, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin() + .console_interaction_stream(&self.opts.console_opts), ) .await??; let ProfileResponse { diff --git a/buck2_client/src/commands/run.rs b/buck2_client/src/commands/run.rs index 4997431e463e5..5bdc70809aced 100644 --- a/buck2_client/src/commands/run.rs +++ b/buck2_client/src/commands/run.rs @@ -112,7 +112,7 @@ impl StreamingCommand for RunCommand { build_opts: Some(self.build_opts.to_proto()), final_artifact_materializations: Materializations::Materialize as i32, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await; diff --git a/buck2_client/src/commands/targets.rs b/buck2_client/src/commands/targets.rs index f9a05308cd9b5..626c4ea90b378 100644 --- a/buck2_client/src/commands/targets.rs +++ b/buck2_client/src/commands/targets.rs @@ -225,7 +225,7 @@ impl StreamingCommand for TargetsCommand { }; if self.show_output { - targets_show_outputs(ctx.stdin(), buckd, target_request, None).await + targets_show_outputs(ctx.stdin(), buckd, target_request, None, &self.console_opts).await } else if self.show_full_output { let project_root = ctx.paths()?.roots.project_root.clone(); targets_show_outputs( @@ -233,10 +233,11 @@ impl StreamingCommand for TargetsCommand { buckd, target_request, Some(project_root.root()), + &self.console_opts, ) .await } else { - targets(ctx.stdin(), buckd, target_request).await + targets(ctx.stdin(), buckd, target_request, &self.console_opts).await } } @@ -258,10 +259,14 @@ async fn targets_show_outputs( mut buckd: BuckdClientConnector, target_request: TargetsRequest, root_path: Option<&AbsPath>, + console_opts: &CommonConsoleOptions, ) -> ExitResult { let response = buckd .with_flushing() - .targets_show_outputs(target_request, stdin.console_interaction_stream()) + .targets_show_outputs( + target_request, + stdin.console_interaction_stream(console_opts), + ) .await??; for target_paths in response.targets_paths { for path in target_paths.paths { @@ -289,10 +294,14 @@ async fn targets( stdin: &mut Stdin, mut buckd: BuckdClientConnector, target_request: TargetsRequest, + console_opts: &CommonConsoleOptions, ) -> ExitResult { let response = buckd .with_flushing() - .targets(target_request, stdin.console_interaction_stream()) + .targets( + target_request, + stdin.console_interaction_stream(console_opts), + ) .await??; if !response.serialized_targets_output.is_empty() { crate::print!("{}", response.serialized_targets_output)?; diff --git a/buck2_client/src/commands/test.rs b/buck2_client/src/commands/test.rs index 7ab78e0a6b3a5..034d46c81579b 100644 --- a/buck2_client/src/commands/test.rs +++ b/buck2_client/src/commands/test.rs @@ -162,7 +162,7 @@ impl StreamingCommand for TestCommand { force_run_from_project_root: self.unstable_force_tests_on_re, }), }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await??; diff --git a/buck2_client/src/commands/uquery.rs b/buck2_client/src/commands/uquery.rs index 20c738e8a1a68..e81515f9bbb8b 100644 --- a/buck2_client/src/commands/uquery.rs +++ b/buck2_client/src/commands/uquery.rs @@ -227,7 +227,7 @@ impl StreamingCommand for UqueryCommand { unstable_output_format, target_call_stacks: self.query_common.target_call_stacks, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await??; diff --git a/buck2_client/src/stdin.rs b/buck2_client/src/stdin.rs index 3fcf5e88a8b35..4dcf322ba8dd3 100644 --- a/buck2_client/src/stdin.rs +++ b/buck2_client/src/stdin.rs @@ -20,6 +20,7 @@ use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; use tokio_util::io::StreamReader; +use crate::common::CommonConsoleOptions; use crate::console_interaction_stream::ConsoleInteractionStream; #[pin_project] @@ -99,7 +100,10 @@ impl Stdin { ) } - pub fn console_interaction_stream(&mut self) -> Option> { + pub fn console_interaction_stream( + &mut self, + _opts: &CommonConsoleOptions, + ) -> Option> { ConsoleInteractionStream::new(self) } } diff --git a/cli/src/commands/docs/starlark.rs b/cli/src/commands/docs/starlark.rs index a6c89f699840c..ec2c9cb0f37d2 100644 --- a/cli/src/commands/docs/starlark.rs +++ b/cli/src/commands/docs/starlark.rs @@ -89,7 +89,7 @@ impl StreamingCommand for DocsStarlarkCommand { retrieve_builtins: self.builtins, retrieve_prelude: self.prelude, }, - ctx.stdin().console_interaction_stream(), + ctx.stdin().console_interaction_stream(&self.console_opts), ) .await??;