aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2016-03-15 08:31:29 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2016-03-15 08:35:45 +0900
commit044a51d57c9db8d3aad5f1ee43f6c6d601dbfdbc (patch)
treeaaf2fe12375fec89b7e5bf347ab71033efe12a02
parentc3a483478a6a38caf174c1a439dda6e0c91a0cd6 (diff)
downloadkati-044a51d57c9db8d3aad5f1ee43f6c6d601dbfdbc.tar.gz
Fix https://github.com/google/kati/issues/47
-rw-r--r--ninja.cc12
-rw-r--r--testcase/fail_ignore_error.mk6
2 files changed, 9 insertions, 9 deletions
diff --git a/ninja.cc b/ninja.cc
index 41e5db4..c95ee64 100644
--- a/ninja.cc
+++ b/ninja.cc
@@ -407,25 +407,19 @@ class NinjaGenerator {
static bool was_gomacc_found = false;
bool got_descritpion = false;
bool use_gomacc = false;
- bool should_ignore_error = false;
auto command_count = commands.size();
for (const Command* c : commands) {
size_t cmd_begin = cmd_buf->size();
if (!cmd_buf->empty()) {
- if (should_ignore_error) {
- *cmd_buf += " ; ";
- } else {
- *cmd_buf += " && ";
- }
+ *cmd_buf += " && ";
}
- should_ignore_error = c->ignore_error;
const char* in = c->cmd.c_str();
while (isspace(*in))
in++;
- bool needs_subshell = command_count > 1;
+ bool needs_subshell = (command_count > 1 || c->ignore_error);
if (needs_subshell)
*cmd_buf += '(';
@@ -455,7 +449,7 @@ class NinjaGenerator {
was_gomacc_found = true;
}
- if (c == commands.back() && c->ignore_error) {
+ if (c->ignore_error) {
*cmd_buf += " ; true";
}
diff --git a/testcase/fail_ignore_error.mk b/testcase/fail_ignore_error.mk
new file mode 100644
index 0000000..c4e71a6
--- /dev/null
+++ b/testcase/fail_ignore_error.mk
@@ -0,0 +1,6 @@
+# TODO(go-ninja): Fix
+
+test:
+ false
+ -false
+ echo FAIL