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

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/cap-primitives-3.4.2/src/rustix/fs/file_path.rs
wasmtime-28.0.0 ./ext/cargo-vendor/cap-primitives-3.4.2/src/rustix/fs/file_path.rs
wasmtime-27.0.0 ./ext/cargo-vendor/cap-primitives-3.4.1/src/rustix/fs/file_path.rs
wasmtime-26.0.0 ./ext/cargo-vendor/cap-primitives-3.3.0/src/rustix/fs/file_path.rs
wasmtime-25.0.2 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/fs/file_path.rs
wasmtime-25.0.1 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/fs/file_path.rs
wasmtime-25.0.0 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/fs/file_path.rs
wasmtime-24.0.0 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/fs/file_path.rs
wasmtime-23.0.2 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/fs/file_path.rs
wasmtime-22.0.0 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/fs/file_path.rs
wasmtime-21.0.1 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/fs/file_path.rs
wasmtime-20.0.2 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/fs/file_path.rs
wasmtime-20.0.0 ./ext/cargo-vendor/cap-primitives-3.0.0/src/rustix/fs/file_path.rs
wasmtime-18.0.3 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/fs/file_path.rs
wasmtime-17.0.1 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/fs/file_path.rs
wasmtime-17.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/fs/file_path.rs
wasmtime-16.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/fs/file_path.rs
wasmtime-15.0.1 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/fs/file_path.rs
wasmtime-15.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/fs/file_path.rs
wasmtime-14.0.4 ./ext/cargo-vendor/cap-primitives-2.0.0/src/rustix/fs/file_path.rs