ninja-build / ninja

a small build system with a focus on speed
https://ninja-build.org/
Apache License 2.0
10.93k stars 1.58k forks source link

ninja build files lacks of line feed #2379

Open jdai opened 6 months ago

jdai commented 6 months ago

similar problem: https://stackoverflow.com/questions/46970462/how-to-enable-multiline-logs-instead-of-single-line-progress-logs

ninja

I read lineprinter.cc, woul dit be the 1st line below lacks of "\n"? printf("%s", to_print.c_str()); printf("\x1B[K"); // Clear to end of line. fflush(stdout);

endif

have_blank_line_ = false;

} else { printf("%s\n", to_print.c_str()); }

================ OS Name Microsoft Windows 11 Enterprise Version 10.0.22631 Build 22631

PS E:\repos\king> git --version git version 2.43.0.windows.1


PS E:\repos\king> $PSVertionTable; $Host Name : ConsoleHost Version : 5.1.22621.2506 InstanceId : ad82b908-ad36-4994-8241-d9be350b2825 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : en-US CurrentUICulture : en-US PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace

digit-google commented 3 months ago

This is working as intended.

The purpose of the code you are showing is to replace the content of the current line, without jumping to the next one. This is how Ninja displays its status when it is run in an interactive terminal (but not when invoked from a script, or when its output is piped to another command).

You can use ninja ... | cat on Posix to avoid this (in this case each status line is printed in its own separate line), or ninja .. > CON on Windows (same result).

Another way is to declare TERM=dumb in your environment.