Commit bf408a48 authored by jan.koester's avatar jan.koester
Browse files

tes

parent 6be30346
Loading
Loading
Loading
Loading
+16 −0
Changes for src/shell.cpp: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2499,6 +2499,22 @@ int fresh::Shell::runSimple(const std::string &segment){
            stageRedirs.push_back(redir);
            continue;
        }
        // "{ cmds; } redirection": same handling as "(cmds)" just above --
        // every stage of a pipeline already runs forked+isolated regardless
        // (see runStageChild()'s own comment), so a "{ }" group stage gets
        // exactly the same subshell-body recursion a "(...)" one would,
        // which is also exactly what real shells do for it here (e.g. the
        // Linux kernel's own scripts/syscallhdr.sh: "grep ... | { echo ...;
        // while read ...; done; } > outfile" -- without this, "{" itself
        // was tokenized as a literal, nonexistent command instead of a
        // group opener at all).
        if(extractBraceGroupBody(rawstages[i],subshellBody,suffix)){
            stageSubshellBody.push_back(subshellBody);
            std::vector<std::string> tokens=tokenizeShellArgs(suffix);
            stageTokens.push_back(extractRedirections(tokens,redir));
            stageRedirs.push_back(redir);
            continue;
        }
        stageSubshellBody.push_back("");

        std::vector<std::string> tokens=tokenizeShellArgs(rawstages[i]);