aboutsummaryrefslogtreecommitdiff
path: root/exec.cc
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-06-25 18:24:11 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-06-25 18:24:11 +0900
commit14bb279334c9db568f6cb8b8854f4309b3bfbc5e (patch)
tree47b4523f02967b1de20ce8ce47c00bb2fbc4dc68 /exec.cc
parent5e9def34c7c527406f9e60ec162a7a6fcc9a30c4 (diff)
downloadkati-14bb279334c9db568f6cb8b8854f4309b3bfbc5e.tar.gz
[C++] Fix multiline_recipe.mk
Diffstat (limited to 'exec.cc')
-rw-r--r--exec.cc32
1 files changed, 18 insertions, 14 deletions
diff --git a/exec.cc b/exec.cc
index 8035965..051a593 100644
--- a/exec.cc
+++ b/exec.cc
@@ -178,28 +178,32 @@ 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 = TrimLeftSpace(*cmds_buf);
- while (true) {
- 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');
+ size_t lf_cnt;
+ size_t index = FindEndOfLine(cmds, 0, &lf_cnt);
+ if (index == cmds.size())
+ index = string::npos;
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));
+ }
+
if (!cmd.empty()) {
Runner* runner = new Runner;
runner->output = n->output;