Fix srun_fastsurfer termination on files inspection#741
Merged
Conversation
… value and terminating, if its condition is not met. In stools (and srun_fastsurfer), we use such a condition to generate the content of a variable, but this may terminate the script if run with `set -e` which srun_fastsurfer.sh sets itself. So this addresses situations, where a short if-else statement is intented in bash of the form: `[[ <condition> ]] && echo "true-value" || echo "false-value"`, but the `false-value` is intended to be "" and thus abbreviated to `[[ <condition> ]] && echo "true-value"` (which returns a non-zero exit code in for the whole statement).
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds explicit || echo "" clauses to command substitutions in bash scripts. The changes modify conditional string constructions that append values to variables based on test conditions.
- Adds
|| echo ""fallback to command substitutions with&& echopatterns - Affects PYTHONPATH construction and condition string building logic
- Changes are functionally equivalent to the original code
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| stools.sh | Adds redundant ` |
| run_fastsurfer.sh | Adds redundant ` |
| recon_surf/long_prepare_template.sh | Adds redundant ` |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
Well, code pilot basically wanted to revert all the changes of the PR, completely misunderstanding the reason behind the changes. |
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.
This PR fixes issues of srun_fastsurfer terminating without proper error message.
This occurs when pipeline-checks return with a non-zero value and terminating, if its condition is not met. See #740.
In stools (and srun_fastsurfer), we use such a condition to generate the content of a variable, but this may terminate the script if run with
set -ewhich srun_fastsurfer.sh sets itself.So this addresses situations, where a short if-else statement is intented in bash of the form:
[[ <condition> ]] && echo "true-value" || echo "false-value", but thefalse-valueis intended to be "" and thus abbreviated to[[ <condition> ]] && echo "true-value"(which returns a non-zero exit code in for the whole statement).