File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 48
48
#include < unistd.h>
49
49
50
50
OwnPtr<DebugSession> g_debug_session;
51
+ static bool g_should_output_color = false ;
51
52
52
53
static void handle_sigint (int )
53
54
{
@@ -70,8 +71,8 @@ void print_syscall(PtraceRegisters& regs, size_t depth)
70
71
for (size_t i = 0 ; i < depth; ++i) {
71
72
printf (" " );
72
73
}
73
- const char * begin_color = " \033 [34;1m" ;
74
- const char * end_color = " \033 [0m" ;
74
+ const char * begin_color = g_should_output_color ? " \033 [34;1m" : " " ;
75
+ const char * end_color = g_should_output_color ? " \033 [0m" : " " ;
75
76
printf (" => %sSC_%s(0x%x, 0x%x, 0x%x)%s\n " ,
76
77
begin_color,
77
78
Syscall::to_string (
@@ -115,6 +116,9 @@ int main(int argc, char** argv)
115
116
return 1 ;
116
117
}
117
118
119
+ if (isatty (STDOUT_FILENO))
120
+ g_should_output_color = true ;
121
+
118
122
const char * command = nullptr ;
119
123
Core::ArgsParser args_parser;
120
124
args_parser.add_positional_argument (command,
You can’t perform that action at this time.
0 commit comments