From 860fba699d95cf2b49670ab0df4cd1a68749502b Mon Sep 17 00:00:00 2001 From: Yashodhan Joshi Date: Mon, 28 Oct 2024 11:18:50 +0530 Subject: [PATCH] print "unknown" instead of defaults if we cannot get kernel config Signed-off-by: Yashodhan Joshi --- crates/youki/src/commands/info.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/youki/src/commands/info.rs b/crates/youki/src/commands/info.rs index 4a92b1ac..f9e1c786 100644 --- a/crates/youki/src/commands/info.rs +++ b/crates/youki/src/commands/info.rs @@ -59,6 +59,8 @@ pub fn print_os() { println!("{:<18}{}", "Operating System", os); } else if let Some(os) = try_read_os_from("/usr/lib/os-release") { println!("{:<18}{}", "Operating System", os); + } else { + println!("{:<18}UNKNOWN", "Operating System"); } } @@ -204,6 +206,9 @@ pub fn print_namespaces() { println!("{:<18}disabled", "Namespaces"); return; } + } else { + println!("{:<18}UNKNOWN", "Namespaces"); + // we don't return as we can atleast try and see if anything is enabled } // mount namespace is always enabled if namespaces are enabled @@ -266,7 +271,7 @@ fn print_feature_status(config: &str, feature: &str, display: FeatureDisplay) { println!(" {:<16}{}", display.name, status); } else { - println!(" {:<16}{}", display.name, display.disabled); + println!(" {:<16}UNKNOWN", display.name); } }