Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

docs(server): the Hub's catch_unwind holds where panics unwind, not in the window

Jareer848d3c5da087
diff --git a/src/Cargo.toml b/src/Cargo.toml
index 826e58af..1dd4ecd1 100644
--- a/src/Cargo.toml
+++ b/src/Cargo.toml
@@ -107,9 +107,11 @@ inherits = "release"
lto = "fat"
# No unwind tables and no landing pads: every call site loses its unwind
# edge, which frees the optimiser and shrinks the binary. This is a GUI
-# binary with no tests and no catch_unwind, and unwinding through the ObjC
-# frames of the macOS event loop was never well-defined anyway - winit only
-# catches panics to avoid exactly that.
+# binary with no tests, and unwinding through the ObjC frames of the macOS
+# event loop was never well-defined anyway - winit only catches panics to
+# avoid exactly that. The one catch_unwind it links, the server Hub's
+# around each API call, does nothing here: a panicking call ends the window
+# as before, and is only an error response in the CLI's server.
panic = "abort"
# Symbols are worth nothing in a release binary that is not being profiled.
# Build with `--profile release` instead before running Instruments or perf.
diff --git a/src/crates/concat-server/src/hub.rs b/src/crates/concat-server/src/hub.rs
index 81838e58..816671d6 100644
--- a/src/crates/concat-server/src/hub.rs
+++ b/src/crates/concat-server/src/hub.rs
@@ -85,7 +85,9 @@ impl Hub {
// end of the thread every later caller waits on. The
// documents a method had half-edited stay as they are,
// which is what a crash of the whole window would have
- // left on disk anyway.
+ // left on disk anyway. Only where panics unwind: the
+ // CLI's server and the tests, not the window built
+ // with `--profile app`, which aborts on any panic.
let response = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
api.dispatch(task.request)
}))