Skip to content

Comments

Fix(run_synthesis.sh): fail if any command fails#119

Merged
phsauter merged 1 commit intopulp-platform:mainfrom
Xelef2000:fix/yosys-sync-script/fail-on-any
Feb 24, 2026
Merged

Fix(run_synthesis.sh): fail if any command fails#119
phsauter merged 1 commit intopulp-platform:mainfrom
Xelef2000:fix/yosys-sync-script/fail-on-any

Conversation

@Xelef2000
Copy link
Contributor

Problem

run_yosys() {
    run_cmd "echo [INFO][Yosys] Synthesizing ${TOP_DESIGN}"
    run_cmd "yosys \
        -c scripts/yosys_synthesis.tcl 2>&1 | \
        TZ=UTC gawk '{ print strftime(\"[%Y-%m-%d %H:%M %Z]\"), \$0 }' | \
        tee ${PROJ_NAME}.log | \
        gawk -f scripts/filter_output.awk"
}

If yosys synthesis fails, the bash only passes on the exit command of the last command in the pipe chain, in this case, the result of the gawk command.
This means that even if yosys fails, the script will still exit with a return value of 0, which is unhelpful when it is invoked by another script/tool.

Solution
Set set -o pipefail, which means that the script will return the exit status of the rightmost command that failed, or 0 if none failed.

@phsauter phsauter merged commit 4ca88de into pulp-platform:main Feb 24, 2026
1 check passed
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.

2 participants