Skip to content

Commit d948073

Browse files
branchseerclaude
andcommitted
fix: guard interactive selector against execution flags, cap semaphore
- Only show the interactive task selector when no execution flags (--concurrency-limit, --parallel) are present - Cap semaphore permits to Semaphore::MAX_PERMITS to avoid panic when concurrency_limit is usize::MAX (from --parallel) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ac6905e commit d948073

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

crates/vite_task/src/session/execute/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ impl ExecutionContext<'_> {
8888
return;
8989
}
9090

91-
let semaphore = Arc::new(Semaphore::new(graph.concurrency_limit));
91+
let semaphore =
92+
Arc::new(Semaphore::new(graph.concurrency_limit.min(Semaphore::MAX_PERMITS)));
9293

9394
// Compute dependency count for each node.
9495
// Edge A→B means "A depends on B", so A's dependency count = outgoing edge count.

crates/vite_task/src/session/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,13 @@ impl<'a> Session<'a> {
274274
self.plan_from_cli_run_resolved(cwd, run_command.clone()).await?;
275275

276276
if graph.graph.node_count() == 0 {
277-
// No tasks matched. With is_cwd_only (no scope flags) the
278-
// task name is a typo — show the selector. Otherwise error.
279-
if is_cwd_only {
277+
// No tasks matched. Show the interactive selector only when
278+
// the command has no scope flags and no execution flags
279+
// (concurrency-limit, parallel) — otherwise the user intended
280+
// a specific execution mode and a typo should be an error.
281+
let has_execution_flags = run_command.flags.concurrency_limit.is_some()
282+
|| run_command.flags.parallel;
283+
if is_cwd_only && !has_execution_flags {
280284
let qpr = self.handle_no_task(is_interactive, &run_command).await?;
281285
self.plan_from_query(qpr).await?
282286
} else {

0 commit comments

Comments
 (0)