Use exit status

This commit is contained in:
Aoran Zeng 2024-08-30 23:22:53 +08:00
parent b45b767468
commit 8175d3ee42
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -7,7 +7,7 @@
* Contributors : Peng Gao <gn3po4g@outlook.com> * Contributors : Peng Gao <gn3po4g@outlook.com>
* | * |
* Created on : <2023-08-29> * Created on : <2023-08-29>
* Last modified : <2024-08-23> * Last modified : <2024-08-30>
* *
* chsrc * chsrc
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
@ -123,7 +123,7 @@ log_check_result (const char *check_what, const char *check_type, bool exist)
* @translation Done * @translation Done
*/ */
void void
log_cmd_result (bool result, int ret_code) log_cmd_result (bool result, int exit_status)
{ {
char *run_msg = NULL; char *run_msg = NULL;
char *succ_msg = NULL; char *succ_msg = NULL;
@ -133,13 +133,13 @@ log_cmd_result (bool result, int ret_code)
{ {
run_msg = "RUN"; run_msg = "RUN";
succ_msg = YesMark " executed successfully"; succ_msg = YesMark " executed successfully";
fail_msg = NoMark " executed unsuccessfully, return code "; fail_msg = NoMark " executed unsuccessfully, exit status: ";
} }
else else
{ {
run_msg = "运行"; run_msg = "运行";
succ_msg = YesMark " 命令执行成功"; succ_msg = YesMark " 命令执行成功";
fail_msg = NoMark " 命令执行失败,返回码 "; fail_msg = NoMark " 命令执行失败,退出状态: ";
} }
if (result) if (result)
@ -147,7 +147,7 @@ log_cmd_result (bool result, int ret_code)
else else
{ {
char buf[8] = {0}; char buf[8] = {0};
sprintf (buf, "%d", ret_code); sprintf (buf, "%d", exit_status);
char *log = xy_2strjoin (red (fail_msg), bdred (buf)); char *log = xy_2strjoin (red (fail_msg), bdred (buf));
xy_log_brkt (red (App_Name), bdred (run_msg), log); xy_log_brkt (red (App_Name), bdred (run_msg), log);
} }