Skip to content

Commit d71ea42

Browse files
author
Mikachu2333
authored
Use yellow as error log color when use RunOpt_Dont_Abort_On_Failure
1 parent d1149d8 commit d71ea42

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/framework/core.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ log_check_result (const char *check_what, const char *check_type, bool exist)
295295

296296

297297
static void
298-
log_cmd_result (bool result, int exit_status)
298+
log_cmd_result (bool result, int exit_status, bool use_yellow_for_error)
299299
{
300300
char *run_msg = NULL;
301301
char *succ_msg = NULL;
@@ -320,8 +320,17 @@ log_cmd_result (bool result, int exit_status)
320320
{
321321
char buf[8] = {0};
322322
sprintf (buf, "%d", exit_status);
323-
char *log = xy_2strcat (red (fail_msg), bdred (buf));
324-
xy_log_brkt (red (App_Name), bdred (run_msg), log);
323+
324+
if (use_yellow_for_error)
325+
{
326+
char *log = xy_2strcat (yellow (fail_msg), bdyellow (buf));
327+
xy_log_brkt (yellow (App_Name), bdyellow (run_msg), log);
328+
}
329+
else
330+
{
331+
char *log = xy_2strcat (red (fail_msg), bdred (buf));
332+
xy_log_brkt (red (App_Name), bdred (run_msg), log);
333+
}
325334
}
326335
}
327336

@@ -1312,16 +1321,18 @@ chsrc_run (const char *cmd, int run_option)
13121321
}
13131322

13141323
int status = system (cmd);
1324+
bool use_yellow_for_error = (run_option & RunOpt_Dont_Abort_On_Failure) != 0;
1325+
13151326
if (0==status)
13161327
{
13171328
if (! (RunOpt_Dont_Notify_On_Success & run_option))
13181329
{
1319-
log_cmd_result (true, status);
1330+
log_cmd_result (true, status, use_yellow_for_error);
13201331
}
13211332
}
13221333
else
13231334
{
1324-
log_cmd_result (false, status);
1335+
log_cmd_result (false, status, use_yellow_for_error);
13251336
if (! (run_option & RunOpt_Dont_Abort_On_Failure))
13261337
{
13271338
char *msg = ENGLISH ? "Fatal error, forced end" : "关键错误,强制结束";

0 commit comments

Comments
 (0)