mirror of
https://git.proxmox.com/git/proxmox
synced 2025-06-14 13:08:56 +00:00
router: Use safe wrapper for libc::isatty
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
430df21720
commit
3f92e6286b
@ -1,4 +1,4 @@
|
|||||||
use std::io::Write;
|
use std::io::{IsTerminal, Write};
|
||||||
|
|
||||||
use anyhow::{bail, format_err, Error};
|
use anyhow::{bail, format_err, Error};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
@ -245,7 +245,7 @@ impl TableFormatOptions {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut me = Self::default();
|
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 {
|
if is_tty {
|
||||||
let (_rows, columns) = stdout_terminal_size();
|
let (_rows, columns) = stdout_terminal_size();
|
||||||
|
Loading…
Reference in New Issue
Block a user