Sha256: 088ac66aa8ea81407909781998398bd731291667e352126bd2e2655a8e0c0c68
Contents?: true
Size: 668 Bytes
Versions: 38
Compression:
Stored size: 668 Bytes
Contents
use crate::fs::file_path_by_searching; #[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))] use rustix::termios::ttyname; #[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))] use std::ffi::OsString; use std::fs; #[cfg(unix)] use std::os::unix::ffi::OsStringExt; use std::path::PathBuf; pub(crate) fn file_path_by_ttyname_or_seaching(file: &fs::File) -> Option<PathBuf> { // If it happens to be a tty, we can look up its name. #[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))] if let Ok(name) = ttyname(file, Vec::new()) { return Some(OsString::from_vec(name.into_bytes()).into()); } file_path_by_searching(file) }
Version data entries
38 entries across 38 versions & 1 rubygems