From f4d083bf64d1a2b4f603d0f5fa96f3ac4e7db1fe Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 4 Jan 2021 19:51:38 +0100 Subject: Add run command, remove colored text output if output is redirected to file --- backend/ninja/Ninja.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'backend') diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 8b815cb..fad1d35 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -12,6 +12,7 @@ using namespace std; using namespace sibs; #if OS_FAMILY == OS_FAMILY_POSIX +#include #define nprintf printf #else #define nprintf wprintf @@ -1889,9 +1890,19 @@ namespace backend Result Ninja::compile(const _tinydir_char_t *buildFilePath) { #if OS_TYPE == OS_TYPE_LINUX - FileString command = TINYDIR_STRING("script -eqc 'ninja -C \""); - command += buildFilePath; - command += TINYDIR_STRING("\"' /dev/null"); + FileString command; + if(isatty(STDOUT_FILENO) == 1) + { + command = TINYDIR_STRING("script -eqc 'ninja -C \""); + command += buildFilePath; + command += TINYDIR_STRING("\"' /dev/null"); + } + else + { + command = TINYDIR_STRING("ninja -C \""); + command += buildFilePath; + command += TINYDIR_STRING("\""); + } #else FileString command = TINYDIR_STRING("ninja -C \""); command += buildFilePath; -- cgit v1.2.3