diff options
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-06-24 22:13:35 +0900 |
---|---|---|
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-06-25 17:51:01 +0900 |
commit | 70bbc4d783441ad6699cdd3960e16cc3a1d56270 (patch) | |
tree | 5530d1f6e7a6820174151b8417711773e47c3803 /exec.cc | |
parent | a4d0ecb979db4a85dd3e62e76619854cd66dd0c1 (diff) | |
download | kati-70bbc4d783441ad6699cdd3960e16cc3a1d56270.tar.gz |
[C++] Fix silent.mk
Diffstat (limited to 'exec.cc')
-rw-r--r-- | exec.cc | 42 |
1 files changed, 25 insertions, 17 deletions
@@ -168,31 +168,39 @@ class Executor { void CreateRunners(DepNode* n, vector<Runner*>* runners) { ev_->set_current_scope(n->rule_vars); current_dep_node_ = n; + bool echo = true; + bool ignore_error = false; for (Value* v : n->cmds) { shared_ptr<string> cmds_buf = v->Eval(ev_); - StringPiece cmds = *cmds_buf; - if (TrimSpace(cmds) == "") - continue; + StringPiece cmds = TrimLeftSpace(*cmds_buf); while (true) { - size_t index = cmds.find('\n'); - if (index == string::npos) + char c = cmds.get(0); + if (c == '@') + echo = false; + else if (c == '-') + ignore_error = true; + else break; + cmds = TrimLeftSpace(cmds.substr(1)); + } + if (cmds == "") + continue; + while (true) { + size_t index = cmds.find('\n'); StringPiece cmd = TrimLeftSpace(cmds.substr(0, index)); cmds = cmds.substr(index + 1); - if (cmd.empty()) - continue; - Runner* runner = new Runner; - runner->output = n->output; - runner->cmd = make_shared<string>(cmd.as_string()); - runners->push_back(runner); + if (!cmd.empty()) { + Runner* runner = new Runner; + runner->output = n->output; + runner->cmd = make_shared<string>(cmd.as_string()); + runner->echo = echo; + runner->ignore_error = ignore_error; + runners->push_back(runner); + } + if (index == string::npos) + break; } - if (cmds.empty()) - continue; - Runner* runner = new Runner; - runner->output = n->output; - runner->cmd = make_shared<string>(cmds.as_string()); - runners->push_back(runner); continue; } ev_->set_current_scope(NULL); |