Skip to content
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
60 changes: 0 additions & 60 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/fbuild-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }
futures = { workspace = true }
running-process = { workspace = true }
ctrlc = "3.5.2"
blake3 = { workspace = true }
sha2 = { workspace = true }
tempfile = { workspace = true }
Expand Down
16 changes: 10 additions & 6 deletions crates/fbuild-cli/src/cli/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ pub async fn async_main() {
tracing::warn!("{} is set but fbuild does not act on it", var);
}

// Handle Ctrl+C with exit code 130 (standard POSIX SIGINT behavior, matches Python)
ctrlc::set_handler(move || {
output::warn("Interrupted");
std::process::exit(130);
})
.ok();
// Handle Ctrl+C with exit code 130 (standard POSIX SIGINT behavior, matches Python).
// Tokio's cross-platform signal driver avoids pulling the Objective-C runtime
// through ctrlc -> dispatch2 -> objc2 into the macOS CLI binary
// (FastLED/fbuild#1024).
tokio::spawn(async {
if tokio::signal::ctrl_c().await.is_ok() {
output::warn("Interrupted");
std::process::exit(130);
}
});
Comment on lines +55 to +60

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
soldr cargo tree --offline -p fbuild-cli -e features | rg 'tokio|signal'

Repository: FastLED/fbuild

Length of output: 191


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

git ls-files 'crates/fbuild-cli/src/cli/dispatch.rs' 'crates/fbuild-cli/Cargo.toml'
echo '--- dispatch.rs ---'
sed -n '1,140p' crates/fbuild-cli/src/cli/dispatch.rs
echo '--- Cargo.toml ---'
sed -n '1,220p' crates/fbuild-cli/Cargo.toml

Repository: FastLED/fbuild

Length of output: 6495


Handle Ctrl+C setup errors instead of ignoring them.

tokio::signal::ctrl_c().await returns a Result; is_ok() drops the error path, so if the signal handler cannot be installed the CLI keeps running without Ctrl+C handling or diagnostics. Log the error and exit (or propagate it) instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/fbuild-cli/src/cli/dispatch.rs` around lines 55 - 60, Update the
Ctrl+C handler task around tokio::signal::ctrl_c() to explicitly handle both
Result outcomes: retain the existing interruption warning and exit code 130 on
success, and log the setup error with output::warn or the established diagnostic
mechanism before exiting or propagating the failure when setup fails.


// Notify when running in dev mode (matches Python behavior)
if std::env::var("FBUILD_DEV_MODE").is_ok_and(|v| v == "1") {
Expand Down
Loading