Hotfix to allow Ctrl+C in python scipts #3285
Merged
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.
Partial fix for #3271 , in particular this makes the script in that issue work.
While there are major issues with the signal handling implementation in libmamba (and the fact that ideally it should be a cancelling system with async high-level functions being cancellable, and then scripts/executables decide how to trigger that cancelling), this only helps if
Context.use_default_signal_handler(False)
(or the equivalent in C++) is used.That function had no effect before this PR because the boolean it sets was only taken into account at the construction of the
Context
instance, which necessarilly must happen before the function can be called. To make it effective I (with the help of @Hind-M ) just made sure that the meaning of the variable is re-applied when the function is set. This might break some usage once called, not sure.We discussed with @Hind-M and @JohanMabille a future long-term solution for this but it will not come soon so this is the quickest hotfix for now.