component: Add CatchSignals option to App#1276
Open
kghost wants to merge 1 commit into
Open
Conversation
Owner
|
Thanks! I understand the problem you are trying to solve, but I'm not sure about the proposed solution. If we add an option to stop catching standard signals entirely (like We need a way to restore the terminal before propagating or letting the process handle the signal. Please let me 5 days to resolve this properly. I will request a code review from you. |
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces the
CatchSignalsoption to theAppclass.By default, FTXUI installs signal handlers for standard terminate and crash signals (
SIGTERM,SIGSEGV,SIGINT,SIGILL,SIGABRT, andSIGFPE) to safely clean up and restore the terminal state before exit.However, in many host applications (such as those with dedicated crash-reporting, stack-tracing, or customized signal handling), having FTXUI intercept these signals can conflict with standard error handling.
With this change, users can call
app.CatchSignals(false);before the main loop to completely skip the installation of these standard signals, leaving them to be handled by the parent process.Changes Included
include/ftxui/component/app.hpp: Addedvoid CatchSignals(bool enable = true);option setter to theAppinterface.src/ftxui/component/app.cpp: Addedbool catch_signals_ = true;flag toApp::Internaland conditionalized standard signal installation.src/ftxui/component/app_test.cpp: AddedApp.CatchSignals_Falseunit test verifying custom signal handlers are preserved and invoked whenCatchSignals(false)is set.Verification Results
./build/ftxui-tests --gtest_filter="App.*"(all 15 App-related tests passed).ctestwith a 100% pass rate (331/331 tests passed).