Exit early when a sourced Tcl script fails#103
Open
taraxacum45e9a wants to merge 1 commit into
Open
Conversation
Add a `safe_source` procedure to handle sourcing sub-scripts. If a script fails to execute, print an error message and exit immediately to prevent cascading failures. Signed-off-by: Shen Jiamin <shen_jiamin@comp.nus.edu.sg>
6eac5cc to
4226a42
Compare
taraxacum45e9a
added a commit
to taraxacum45e9a/SLASH
that referenced
this pull request
Jun 1, 2026
Add a `safe_source` procedure to handle sourcing sub-scripts. If a script fails to execute, print an error message and exit immediately to prevent cascading failures. Signed-off-by: Shen Jiamin <shen_jiamin@comp.nus.edu.sg>
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.
Currently, when
create_project.tclsources sub-scripts (likeslash_base.tcl, etc), any failures within those scripts, for example,are silently ignored. The main script continues executing, which can lead to incomplete builds or hard-to-debug cascading errors.
This PR introduces a
safe_sourcehelper procedure that wraps the standard Tclsourcecommand in acatchblock. If a sourced script fails, it terminates execution immediately.