Skip ttyname on apple systems

Not relevant there because they don't have a "console session" as
such, and the ttyname call may hang.

Fixes #12506
This commit is contained in:
Fabian Boehm
2026-03-27 17:35:42 +01:00
parent 454939d5ab
commit 7f5692dfd3

View File

@@ -133,6 +133,7 @@ pub struct UnescapeFlags: u32 {
/// most common operating systems do not use them. The value is cached for the duration of the fish
/// session. We err on the side of assuming it's not a console session. This approach isn't
/// bullet-proof and that's OK.
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
pub fn is_console_session() -> bool {
static IS_CONSOLE_SESSION: OnceLock<bool> = OnceLock::new();
// TODO(terminal-workaround)
@@ -154,6 +155,12 @@ pub fn is_console_session() -> bool {
})
}
#[cfg(any(target_os = "ios", target_os = "macos"))]
pub fn is_console_session() -> bool {
// No console session on Apple, and ttyname may hang (#12506).
false
}
/// Exits without invoking destructors (via _exit), useful for code after fork.
pub fn exit_without_destructors(code: libc::c_int) -> ! {
unsafe { libc::_exit(code) };