mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
SDL: Don't write garbage to output if it is redirected
This commit is contained in:
parent
0c776e3acd
commit
3b50f7dfa6
1 changed files with 3 additions and 2 deletions
|
@ -175,10 +175,11 @@ void I_PrintStr(const char *cp)
|
||||||
{
|
{
|
||||||
const char * srcp = cp;
|
const char * srcp = cp;
|
||||||
FString printData = "";
|
FString printData = "";
|
||||||
|
bool terminal = isatty(STDOUT_FILENO);
|
||||||
|
|
||||||
while (*srcp != 0)
|
while (*srcp != 0)
|
||||||
{
|
{
|
||||||
if (*srcp == 0x1c && con_printansi)
|
if (*srcp == 0x1c && con_printansi && terminal)
|
||||||
{
|
{
|
||||||
srcp += 1;
|
srcp += 1;
|
||||||
EColorRange range = V_ParseFontColor((const uint8_t*&)srcp, CR_UNTRANSLATED, CR_YELLOW);
|
EColorRange range = V_ParseFontColor((const uint8_t*&)srcp, CR_UNTRANSLATED, CR_YELLOW);
|
||||||
|
@ -224,7 +225,7 @@ void I_PrintStr(const char *cp)
|
||||||
|
|
||||||
if (StartScreen) CleanProgressBar();
|
if (StartScreen) CleanProgressBar();
|
||||||
fputs(printData.GetChars(),stdout);
|
fputs(printData.GetChars(),stdout);
|
||||||
fputs("\033[0m",stdout);
|
if (terminal) fputs("\033[0m",stdout);
|
||||||
if (StartScreen) RedrawProgressBar(ProgressBarCurPos,ProgressBarMaxPos);
|
if (StartScreen) RedrawProgressBar(ProgressBarCurPos,ProgressBarMaxPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue