mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-22 20:31:15 -03:00
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:
@@ -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) };
|
||||
|
||||
Reference in New Issue
Block a user