mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 15:51: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
|
/// 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
|
/// session. We err on the side of assuming it's not a console session. This approach isn't
|
||||||
/// bullet-proof and that's OK.
|
/// bullet-proof and that's OK.
|
||||||
|
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
|
||||||
pub fn is_console_session() -> bool {
|
pub fn is_console_session() -> bool {
|
||||||
static IS_CONSOLE_SESSION: OnceLock<bool> = OnceLock::new();
|
static IS_CONSOLE_SESSION: OnceLock<bool> = OnceLock::new();
|
||||||
// TODO(terminal-workaround)
|
// 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.
|
/// Exits without invoking destructors (via _exit), useful for code after fork.
|
||||||
pub fn exit_without_destructors(code: libc::c_int) -> ! {
|
pub fn exit_without_destructors(code: libc::c_int) -> ! {
|
||||||
unsafe { libc::_exit(code) };
|
unsafe { libc::_exit(code) };
|
||||||
|
|||||||
Reference in New Issue
Block a user