Skip to content

Commit 4af86aa

Browse files
committed
Enhance run function in experiment.py to correctly identify and handle bash process substitution syntax "<( cmd )" by using a regex that matches it only at the start of a statement or after whitespace, preventing false positives.
1 parent 77f7651 commit 4af86aa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cgatcore/experiment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,9 @@ def run(statement,
14031403
# remove new lines
14041404
statement = " ".join(re.sub("\t+", " ", statement).split("\n")).strip()
14051405

1406-
if "<(" in statement:
1406+
# Only wrap for real bash process substitution <( cmd ), not "<(" in paths/variables.
1407+
# Match "<(" at start of statement or after whitespace to avoid false positives.
1408+
if re.search(r'(^|\s)<\(', statement):
14071409
shell = os.environ.get('SHELL', "/bin/bash")
14081410
if "bash" not in shell:
14091411
raise ValueError(

0 commit comments

Comments
 (0)