Skip to content

Commit

Permalink
fix subshell parsing
Browse files Browse the repository at this point in the history
See-also: SimonKagstrom#457
Signed-off-by: Mattéo Rossillol‑‑Laruelle <beatussum@protonmail.com>
  • Loading branch information
beatussum committed Jul 31, 2024
1 parent a03bf8d commit a750d47
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/engines/bash-engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ class BashEngine : public ScriptEngineBase
continue;

// While, if, switch endings
if (s == "esac" || s == "fi" || s == "do" || s == "done" || s == "else" || s == "then" || s == "}" || s == "{")
if (s == "esac" || s == "fi" || s == "do" || s == "done" || s == "else" || s == "then" || s == "}" || s == "{" || s == ")" || s == "(")
continue;

// Functions
Expand Down Expand Up @@ -684,6 +684,10 @@ class BashEngine : public ScriptEngineBase
if ((s[0] == '{' || s[0] == '}') && s.size() == 1)
continue;

// Empty parentheses
if ((s[0] == '(' || s[0] == ')') && s.size() == 1)
continue;

// While, if, switch endings
if (s == "esac" || s == "fi" || s == "do" || s == "done" || s == "else" || s == "then")
continue;
Expand Down

0 comments on commit a750d47

Please sign in to comment.