From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox v2 2/2] router: Use safe wrapper for libc::isatty
Date: Fri, 16 Feb 2024 15:59:01 +0100 [thread overview]
Message-ID: <20240216145901.420097-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240216145901.420097-1-m.sandoval@proxmox.com>
From: Maximiliano Sandoval R <m.sandoval@proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval@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 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();
--
2.39.2
next prev parent reply other threads:[~2024-02-16 14:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 14:59 [pbs-devel] [PATCH proxmox v2 1/2] sys: " Maximiliano Sandoval
2024-02-16 14:59 ` Maximiliano Sandoval [this message]
2024-02-16 15:57 ` [pbs-devel] applied: " Dietmar Maurer
-- strict thread matches above, loose matches on Subject: below --
2023-11-20 8:16 [pbs-devel] " Maximiliano Sandoval R
2023-11-20 8:16 ` [pbs-devel] [PATCH proxmox v2 2/2] router: " Maximiliano Sandoval R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240216145901.420097-2-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.