aboutsummaryrefslogtreecommitdiff
path: root/backend/ninja
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-01-04 19:51:38 +0100
committerdec05eba <dec05eba@protonmail.com>2021-01-04 19:51:38 +0100
commitf4d083bf64d1a2b4f603d0f5fa96f3ac4e7db1fe (patch)
tree17e2f02f189b8bd316604cb5b1de7222eb5558bd /backend/ninja
parent1a6c67af3851748a0a604e3b3e99bd63f3f576a0 (diff)
Add run command, remove colored text output if output is redirected to file
Diffstat (limited to 'backend/ninja')
-rw-r--r--backend/ninja/Ninja.cpp17
1 files changed, 14 insertions, 3 deletions
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 <unistd.h>
#define nprintf printf
#else
#define nprintf wprintf
@@ -1889,9 +1890,19 @@ namespace backend
Result<bool> 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;