Skip to content

Exit early when a sourced Tcl script fails#103

Open
taraxacum45e9a wants to merge 1 commit into
Xilinx:devfrom
taraxacum45e9a:early-exit
Open

Exit early when a sourced Tcl script fails#103
taraxacum45e9a wants to merge 1 commit into
Xilinx:devfrom
taraxacum45e9a:early-exit

Conversation

@taraxacum45e9a
Copy link
Copy Markdown

Currently, when create_project.tcl sources sub-scripts (like slash_base.tcl, etc), any failures within those scripts, for example,

if { $bCheckIPsPassed != 1 } {
  common::send_gid_msg -ssname BD::TCL -id 2023 -severity "WARNING" "Will not continue with creation of design due to the error(s) above."
  return 3
}

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_source helper procedure that wraps the standard Tcl source command in a catch block. If a sourced script fails, it terminates execution immediately.

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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant