From cde20a2379375d0b5d9db2944cee80453da82c4e Mon Sep 17 00:00:00 2001 From: licunlong Date: Thu, 31 Aug 2023 19:08:37 +0800 Subject: [PATCH] log the status message to stdout (cherry picked from commit ac49589ac40eed229ba8eee8d1192a3227c80e23) --- ...fix-log-the-status-message-to-stdout.patch | 51 +++++++++++++++++++ sysmaster.spec | 6 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 backport-fix-log-the-status-message-to-stdout.patch diff --git a/backport-fix-log-the-status-message-to-stdout.patch b/backport-fix-log-the-status-message-to-stdout.patch new file mode 100644 index 0000000..e661b8f --- /dev/null +++ b/backport-fix-log-the-status-message-to-stdout.patch @@ -0,0 +1,51 @@ +From 02168f76edce7622dbd72742a45bffa1f9eed5f2 Mon Sep 17 00:00:00 2001 +From: licunlong +Date: Thu, 31 Aug 2023 16:47:13 +0800 +Subject: [PATCH] fix: log the status message to stdout + +--- + core/sctl/src/main.rs | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/core/sctl/src/main.rs b/core/sctl/src/main.rs +index fb949f39..2a721d89 100755 +--- a/core/sctl/src/main.rs ++++ b/core/sctl/src/main.rs +@@ -14,9 +14,12 @@ + + #![allow(deprecated)] + use clap::Parser; +-use cmdproto::proto::{ +- abi::{sys_comm, unit_comm, CommandRequest}, +- mngr_comm, unit_file, ProstClientStream, ++use cmdproto::{ ++ error::ERROR_CODE_MASK_PRINT_STDOUT, ++ proto::{ ++ abi::{sys_comm, unit_comm, CommandRequest}, ++ mngr_comm, unit_file, ProstClientStream, ++ }, + }; + use constants::SCTL_SOCKET; + use std::process::exit; +@@ -251,13 +254,12 @@ fn main() { + exit(0); + } + +- if data.error_code == 0 { +- /* Don't care if we fail to write the error out. */ ++ if data.error_code == 0 || (data.error_code & ERROR_CODE_MASK_PRINT_STDOUT != 0) { ++ /* Don't care if we fail to write the message out. */ + let _ = writeln!(std::io::stdout(), "{}", data.message); +- exit(0); ++ } else { ++ eprintln!("{}", data.message); + } + +- eprintln!("{}", data.message); +- +- exit(data.error_code as i32); ++ exit((data.error_code & !ERROR_CODE_MASK_PRINT_STDOUT) as i32); + } +-- +2.30.2 + diff --git a/sysmaster.spec b/sysmaster.spec index 537a60e..61bd648 100644 --- a/sysmaster.spec +++ b/sysmaster.spec @@ -11,7 +11,7 @@ Name: sysmaster Version: 0.2.5 -Release: 2 +Release: 3 Summary: redesign and reimplement process1. License: Mulan PSL v2 @@ -19,6 +19,7 @@ URL: https://gitee.com/openeuler/sysmaster Source0: %{name}-%{version}.tar.gz Patch6001: backport-fix-delete-and-re-add-the-restart-timer-to-make-time.patch +Patch6002: backport-fix-log-the-status-message-to-stdout.patch ExclusiveArch: x86_64 aarch64 @@ -71,6 +72,9 @@ install -Dm0640 -t %{buildroot}/etc/sysmaster %{conf_install_source}/system.conf /etc/sysmaster/system.conf %changelog +* Thu Aug 31 2023 licunlong - 0.2.5-3 +- log the status message to stdout + * Fri Aug 25 2023 licunlong - 0.2.5-2 - sync patches from upstream