Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(daemon): use correct arg group for deciding daemon config #9088

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ pub struct Args {
#[clap(long, global = true)]
pub dangerously_disable_package_manager_check: bool,
#[clap(flatten, next_help_heading = "Run Arguments")]
pub run_args: Option<RunArgs>,
// DO NOT MAKE THIS VISIBLE
// This is explicitly set to None in `run`
run_args: Option<RunArgs>,
// This should be inside `RunArgs` but clap currently has a bug
// around nested flattened optional args: https://github.com/clap-rs/clap/issues/4697
#[clap(flatten)]
Expand Down Expand Up @@ -459,6 +461,15 @@ impl Args {
);
}
}

/// Fetch the run args supplied to the command
pub fn run_args(&self) -> Option<&RunArgs> {
if let Some(Command::Run { run_args, .. }) = &self.command {
Some(run_args)
} else {
self.run_args.as_ref()
}
}
}

/// Defines the subcommands for CLI. NOTE: If we change the commands in Go,
Expand Down Expand Up @@ -1041,7 +1052,7 @@ pub async fn run(
let mut command = if let Some(command) = mem::take(&mut cli_args.command) {
command
} else {
let run_args = cli_args.run_args.take().unwrap_or_default();
let run_args = cli_args.run_args.clone().unwrap_or_default();
let execution_args = cli_args
.execution_args
// We clone instead of take as take would leave the command base a copy of cli_args
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl CommandBase {
.dangerously_disable_package_manager_check
.then_some(true),
)
.with_daemon(self.args.run_args.as_ref().and_then(|args| args.daemon()))
.with_daemon(self.args.run_args().and_then(|args| args.daemon()))
.with_env_mode(
self.args
.command
Expand Down
Loading