From: Maximiliano Sandoval R Date: Fri, 16 Feb 2024 14:59:01 +0000 (+0100) Subject: router: Use safe wrapper for libc::isatty X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3f92e6286b06bbbfb193876576646e1f0c16975f;hp=430df21720f93ee46c8510d20b07c224c17394ff;p=proxmox.git router: Use safe wrapper for libc::isatty Signed-off-by: Maximiliano Sandoval --- diff --git a/proxmox-router/src/cli/text_table.rs b/proxmox-router/src/cli/text_table.rs index ea50b04b..21e466cd 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, format_err, 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();