Skip to content

Commit

Permalink
Fix google#47
Browse files Browse the repository at this point in the history
  • Loading branch information
shinh committed Mar 14, 2016
1 parent be2a5d3 commit 06c9a77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 3 additions & 9 deletions ninja.cc
Expand Up @@ -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 += '(';
Expand Down Expand Up @@ -455,7 +449,7 @@ class NinjaGenerator {
was_gomacc_found = true;
}

if (c == commands.back() && c->ignore_error) {
if (c->ignore_error) {
*cmd_buf += " ; true";
}

Expand Down
6 changes: 6 additions & 0 deletions testcase/fail_ignore_error.mk
@@ -0,0 +1,6 @@
# TODO(go-ninja): Fix

test:
false
-false
echo FAIL

0 comments on commit 06c9a77

Please sign in to comment.