diff options
author | Colin Cross <ccross@android.com> | 2016-04-28 19:36:49 (GMT) |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-04-29 19:21:46 (GMT) |
commit | af4973d2251bf9bc616ceb5f9d9d64dd948ed569 (patch) | |
tree | 9da4c4ac38b96a3dcb998c53002233398dbe1aeb /src/build.h | |
parent | f1b5d2bf37ba6cd10bf7ab4b51877d68eae97cbc (diff) | |
download | Ninja-af4973d2251bf9bc616ceb5f9d9d64dd948ed569.zip Ninja-af4973d2251bf9bc616ceb5f9d9d64dd948ed569.tar.gz Ninja-af4973d2251bf9bc616ceb5f9d9d64dd948ed569.tar.bz2 |
Fix NINJA_STATUS %r on dumb terminals
PR #999 made dumb terminals only output when edges finish. PrintStatus
is called after finished_edges_ is incremented, which means the
calculation for running edges will always return 1 less than the real
number of running processes. This happens on smart terminals too, but
ninja will immediately print the status for the next edge with
starting_edges_ incremented, so the incorrect value is never visible.
Pass a boolean specifying whether the status is being printed on an edge
finishing, and if so count the edge that just finished as being running.
Diffstat (limited to 'src/build.h')
-rw-r--r-- | src/build.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/build.h b/src/build.h index 51589ef..819d832 100644 --- a/src/build.h +++ b/src/build.h @@ -202,14 +202,21 @@ struct BuildStatus { int* start_time, int* end_time); void BuildFinished(); + enum EdgeStatus { + kEdgeStarted, + kEdgeFinished, + }; + /// Format the progress status string by replacing the placeholders. /// See the user manual for more information about the available /// placeholders. /// @param progress_status_format The format of the progress status. - string FormatProgressStatus(const char* progress_status_format) const; + /// @param finished True if the edge being printed just finished + string FormatProgressStatus(const char* progress_status_format, + EdgeStatus kEdgeFinished) const; private: - void PrintStatus(Edge* edge); + void PrintStatus(Edge* edge, EdgeStatus status); const BuildConfig& config_; |