Print status when edge finishes on dumb terminals
authorColin Cross <ccross@android.com>
Fri, 31 Jul 2015 00:30:52 +0000 (17:30 -0700)
committerColin Cross <ccross@android.com>
Fri, 31 Jul 2015 00:30:52 +0000 (17:30 -0700)
commita4751630cd6d2d753505a6fd222277cf2d99a135
treec7311deccf6dbede12a064216ce3b0a89588fcab
parent7182f8776cc5d4b9c55ae33d06ffa3b4cb3d7000
Print status when edge finishes on dumb terminals

On smart terminals ninja prints the status line both before
and after running a command, reusing the same line if possible.
On a dumb terminal that doesn't support reusing the line, it
only prints the status before starting the command, but prints
the output of the command when the command finishes, by which
point other commands may have started and printed their status
line.  This makes it impossible to determine what command
produced a line of output.

Modify BuildEdgeStarted to only print the status line if the
command is going to lock the console, or if ninja is running
on a smart terminal.  Modify BuildEdgeFinished to always
print the status line unless the command locked the console,
in which case the status was already printed and no other
command can have printed any lines.

The end result will be dumb terminal output that much more
closely matches smart terminal output.  One disadvantage is
that dumb terminals won't show anything when starting a
command, making it harder to tell what commands are currently
running, but I expect most interactive uses of ninja will use
a smart terminal.
src/build.cc