Disable SMSD exit_on_failure to prevent interpreter termination#211
Open
Disable SMSD exit_on_failure to prevent interpreter termination#211
Conversation
- Disable exit_on_failure flag in SMSD config after creation - Add test to verify GetStatus raises exception when SMSD is not running - This fixes the issue where Python would exit instead of raising an exception Co-authored-by: nijel <212189+nijel@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix python-gammu to prevent exit on SMSD not running
Disable SMSD exit_on_failure to prevent interpreter termination
Feb 5, 2026
nijel
reviewed
Feb 5, 2026
for more information, see https://pre-commit.ci
nijel
reviewed
Feb 5, 2026
7 tasks
Member
|
@copilot Rewrite the flag setting using the new API introduced in gammu/gammu#965. I will adjust the dependency and rebase once new Gammu version is released. |
Replace direct access to exit_on_failure field with the new public SMSD_SetExitOnFailure() API introduced in Gammu PR #965. This avoids the compilation issue with the opaque GSM_SMSDConfig structure. The new API provides a proper public interface to disable the exit_on_failure flag, allowing Python to handle errors as exceptions instead of terminating the interpreter. Co-authored-by: nijel <212189+nijel@users.noreply.github.com>
auto-merge was automatically disabled
February 5, 2026 16:19
Head branch was pushed to by a user without write access
Contributor
Author
Updated to use SMSD_SetExitOnFailure() API in commit 29636a9. |
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.
SMSD operations (
GetStatus(),InjectSMS()) terminate the Python interpreter with exit code 255 when SMSD is not running, rather than raising catchable exceptions.Root Cause
Gammu's
GSM_SMSDConfiginitializesexit_on_failure = TRUE, causing library code to callexit()on errors instead of returning error codes.Changes
gammu/src/smsd.c
SMSD_SetExitOnFailure(config, FALSE)afterSMSD_NewConfig()to disable exit on failure and allow Python exception handlingtest/test_smsd.py
GetStatus()raisesGSMErrorwhen daemon not runningImplementation
This fix uses the public
SMSD_SetExitOnFailure()API introduced in Gammu PR #965, which provides a proper interface to disable the exit_on_failure flag without accessing internal structure fields. This approach:GSM_SMSDConfigstructureOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.