Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 9f3463d

Browse files
namenucristianoc
authored andcommitted
log when build fails
1 parent 8ca2c8c commit 9f3463d

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/build.cc

+1-5
Original file line numberDiff line numberDiff line change
@@ -796,11 +796,7 @@ void Builder::Cleanup() {
796796
}
797797
}
798798

799-
if (compiler_log_) {
800-
fprintf(compiler_log_, "#Done(%" PRId64 ")\n", GetTimeMillis());
801-
fclose(compiler_log_);
802-
compiler_log_ = NULL;
803-
}
799+
compiler_log_ = NULL;
804800
}
805801

806802
Node* Builder::AddTarget(const string& name, string* err) {

src/ninja.cc

+13-5
Original file line numberDiff line numberDiff line change
@@ -1172,19 +1172,27 @@ int NinjaMain::RunBuild(int argc, char** argv) {
11721172
printf("ninja: build stopped: %s.\n", err.c_str());
11731173
#else
11741174

1175-
if(ShouldBeColorFul(false)){
1176-
printf("\x1b[31m" "FAILED:" "\x1b[0m" " %s.\n", err.c_str());
1177-
} else {
1178-
printf("FAILED: %s.\n", err.c_str());
1179-
}
1175+
if (ShouldBeColorFul(false)) {
1176+
printf("\x1b[31m" "FAILED:" "\x1b[0m" " %s.\n", err.c_str());
1177+
} else {
1178+
printf("FAILED: %s.\n", err.c_str());
1179+
}
1180+
fprintf(compiler_log_, "FAILED: %s.\n", err.c_str());
11801181

11811182
#endif
1183+
1184+
fprintf(compiler_log_, "#Done(%" PRId64 ")\n", GetTimeMillis());
1185+
fclose(compiler_log_);
1186+
11821187
if (err.find("interrupted by user") != string::npos) {
11831188
return 2;
11841189
}
11851190
return 1;
11861191
}
11871192

1193+
fprintf(compiler_log_, "#Done(%" PRId64 ")\n", GetTimeMillis());
1194+
fclose(compiler_log_);
1195+
11881196
return 0;
11891197
}
11901198

0 commit comments

Comments
 (0)