aboutsummaryrefslogtreecommitdiff
path: root/exec.cc
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-06-24 22:13:35 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-06-25 17:51:01 +0900
commit70bbc4d783441ad6699cdd3960e16cc3a1d56270 (patch)
tree5530d1f6e7a6820174151b8417711773e47c3803 /exec.cc
parenta4d0ecb979db4a85dd3e62e76619854cd66dd0c1 (diff)
downloadkati-70bbc4d783441ad6699cdd3960e16cc3a1d56270.tar.gz
[C++] Fix silent.mk
Diffstat (limited to 'exec.cc')
-rw-r--r--exec.cc42
1 files changed, 25 insertions, 17 deletions
diff --git a/exec.cc b/exec.cc
index a3e8dc9..79e6102 100644
--- a/exec.cc
+++ b/exec.cc
@@ -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);