[pbs-devel] [PATCH proxmox v2 2/2] router: Use safe wrapper for libc::isatty
Maximiliano Sandoval R
m.sandoval at proxmox.com
Mon Nov 20 09:16:30 CET 2023
Signed-off-by: Maximiliano Sandoval R <m.sandoval at proxmox.com>
---
proxmox-router/src/cli/text_table.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/proxmox-router/src/cli/text_table.rs b/proxmox-router/src/cli/text_table.rs
index 9bc7210..3368605 100644
--- a/proxmox-router/src/cli/text_table.rs
+++ b/proxmox-router/src/cli/text_table.rs
@@ -1,4 +1,4 @@
-use std::io::Write;
+use std::io::{IsTerminal, Write};
use anyhow::{bail, Error};
use serde_json::Value;
@@ -245,7 +245,7 @@ impl TableFormatOptions {
pub fn new() -> Self {
let mut me = Self::default();
- let is_tty = unsafe { libc::isatty(libc::STDOUT_FILENO) == 1 };
+ let is_tty = std::io::stdout().is_terminal();
if is_tty {
let (_rows, columns) = stdout_terminal_size();
--
2.39.2
More information about the pbs-devel
mailing list