From fa7f4e68c5183cba9a41f497907aae381c73b563 Mon Sep 17 00:00:00 2001 From: Philip Metzger Date: Wed, 24 Jul 2024 20:16:03 +0200 Subject: [PATCH] run: Treat `jj run -j0 ` as use all available cores Waleed noticed this in #4021. --- cli/src/commands/run.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cli/src/commands/run.rs b/cli/src/commands/run.rs index cbcab0296..5a72251e7 100644 --- a/cli/src/commands/run.rs +++ b/cli/src/commands/run.rs @@ -59,9 +59,8 @@ pub fn cmd_run(ui: &mut Ui, command: &CommandHelper, args: &RunArgs) -> Result<( // 2. the amount of cores available. // 3. a single job, if all of the above fails. let _jobs = match args.jobs { - Some(0) => return Err(user_error("must pass at least one job")), + Some(0) | None => std::thread::available_parallelism().map(|t| t.into()).ok(), Some(jobs) => Some(jobs), - None => std::thread::available_parallelism().map(|t| t.into()).ok(), } // Fallback to a single user-visible job. .unwrap_or(1usize);