!66 [sync] PR-65: log the status message to stdout
From: @openeuler-sync-bot Reviewed-by: @jiayi0118 Signed-off-by: @jiayi0118
This commit is contained in:
commit
708fe6eeff
51
backport-fix-log-the-status-message-to-stdout.patch
Normal file
51
backport-fix-log-the-status-message-to-stdout.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 02168f76edce7622dbd72742a45bffa1f9eed5f2 Mon Sep 17 00:00:00 2001
|
||||
From: licunlong <licunlong1@huawei.com>
|
||||
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
|
||||
|
||||
@ -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<licunlong1@huawei.com> - 0.2.5-3
|
||||
- log the status message to stdout
|
||||
|
||||
* Fri Aug 25 2023 licunlong<licunlong1@huawei.com> - 0.2.5-2
|
||||
- sync patches from upstream
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user