diff options
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-06-25 21:48:23 +0900 |
---|---|---|
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-06-25 21:48:23 +0900 |
commit | 1c448b1590119c77d0711b8cb4c09a53dfe4b695 (patch) | |
tree | 8f910fee628db10122ada5f6d32897d03bcbc8a6 /exec.cc | |
parent | 14bb279334c9db568f6cb8b8854f4309b3bfbc5e (diff) | |
download | kati-1c448b1590119c77d0711b8cb4c09a53dfe4b695.tar.gz |
[C++] Fix silient_multiline.mk
Diffstat (limited to 'exec.cc')
-rw-r--r-- | exec.cc | 35 |
1 files changed, 22 insertions, 13 deletions
@@ -175,12 +175,30 @@ class Executor { } } + void ParseCommandPrefixes(StringPiece* s, bool* echo, bool* ignore_error) { + *s = TrimLeftSpace(*s); + while (true) { + char c = s->get(0); + if (c == '@') { + *echo = false; + } else if (c == '-') { + *ignore_error = true; + } else { + break; + } + *s = TrimLeftSpace(s->substr(1)); + } + } + void CreateRunners(DepNode* n, vector<Runner*>* runners) { ev_->set_current_scope(n->rule_vars); current_dep_node_ = n; for (Value* v : n->cmds) { shared_ptr<string> cmds_buf = v->Eval(ev_); - StringPiece cmds = TrimLeftSpace(*cmds_buf); + StringPiece cmds = *cmds_buf; + bool global_echo = true; + bool global_ignore_error = false; + ParseCommandPrefixes(&cmds, &global_echo, &global_ignore_error); if (cmds == "") continue; while (true) { @@ -191,18 +209,9 @@ class Executor { StringPiece cmd = TrimLeftSpace(cmds.substr(0, index)); cmds = cmds.substr(index + 1); - bool echo = true; - bool ignore_error = false; - while (true) { - char c = cmd.get(0); - if (c == '@') - echo = false; - else if (c == '-') - ignore_error = true; - else - break; - cmd = TrimLeftSpace(cmd.substr(1)); - } + bool echo = global_echo; + bool ignore_error = global_ignore_error; + ParseCommandPrefixes(&cmd, &echo, &ignore_error); if (!cmd.empty()) { Runner* runner = new Runner; |