Skip to content

Fix srun_fastsurfer termination on files inspection#741

Merged
m-reuter merged 1 commit into
Deep-MI:devfrom
dkuegler:fix/srun-exits
Nov 8, 2025
Merged

Fix srun_fastsurfer termination on files inspection#741
m-reuter merged 1 commit into
Deep-MI:devfrom
dkuegler:fix/srun-exits

Conversation

@dkuegler
Copy link
Copy Markdown
Member

@dkuegler dkuegler commented Nov 7, 2025

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 -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).

… 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).
@dkuegler dkuegler requested a review from m-reuter November 7, 2025 14:27
@m-reuter m-reuter requested a review from Copilot November 7, 2025 21:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 && echo patterns
  • 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.

Comment thread stools.sh
Comment thread run_fastsurfer.sh
Comment thread recon_surf/long_prepare_template.sh
Comment thread stools.sh
@dkuegler
Copy link
Copy Markdown
Member Author

dkuegler commented Nov 7, 2025

Well, code pilot basically wanted to revert all the changes of the PR, completely misunderstanding the reason behind the changes.

@m-reuter m-reuter merged commit 40ba28b into Deep-MI:dev Nov 8, 2025
8 checks passed
@dkuegler dkuegler deleted the fix/srun-exits branch November 10, 2025 18:45
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.

3 participants