Commit 16d53963 authored by jan.koester's avatar jan.koester
Browse files

gnu func ext

parent 3691c799
Loading
Loading
Loading
Loading
+12 −7
Changes for executor.cpp: 12 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -610,19 +610,23 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
        std::string expanded = parser_.expand_with_automatic(
            recipe, *mfp, target, first_prereq, prereqs, newer, stem, &order_only);

        // Das gesamte expandierte Rezept als einen einzigen zusammenhängenden
        // Shell-Block ausführen, damit mehrzeilige Shell-Strukturen (if/then/fi)
        // und Inline-Präfixe nicht mitten im Block zerissen werden.
        bool is_silent = silent_;
        bool ignore_error = false;
        bool force_exec = false;

        std::string cmd = expanded;
        size_t start = 0;
        while (start < expanded.size()) {
            if (expanded[start] == '@') { is_silent = true; start++; }
            else if (expanded[start] == '-') { ignore_error = true; start++; }
            else if (expanded[start] == '+') { force_exec = true; start++; }
            else if (expanded[start] == ' ' || expanded[start] == '\t') { start++; }
        while (start < cmd.size()) {
            if (cmd[start] == '@') { is_silent = true; start++; }
            else if (cmd[start] == '-') { ignore_error = true; start++; }
            else if (cmd[start] == '+') { force_exec = true; start++; }
            else if (cmd[start] == ' ' || cmd[start] == '\t') { start++; }
            else break;
        }
        std::string cmd = expanded.substr(start);
        cmd = cmd.substr(start);

        if (cmd.empty()) continue;

@@ -630,7 +634,7 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
            std::cout << cmd << std::endl;
        }

        if (question_) return 1; // question mode: return 1 if would rebuild
        if (question_) return 1;

        if (!dry_run_ || force_exec) {
            int rc = run_command(cmd, recipe_env);
@@ -640,6 +644,7 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
            }
        }
    }

    return 0;
}