Benign crates 3,711,592 installs Download

terminal-trx 0.2.1

“Provides a handle to the terminal of the current process”

Contains an unbounded block loopFile under a vendored native dependency path
SHA-2566d4c86910e10c782a02d3b7606de43cf7ebd80e1fafdca8e49a0db2b0d4611f0

Evidence

Rust OpenOptions builder windows.rs · lines 34–44
34:38… in())
35 .map(Ok)
36 .unwrap_or_else(|| {
37 OpenOptions::new()
38 .read(true)
39 .open("CONIN$")
⋯5 lines
#[cfg(test)] attribute unix.rs · lines 9–19
9:44… , FromRawFd as _};
10use std::os::unix::ffi::OsStrExt;
11
12mod attr;
13#[cfg(test)]
14mod pty_utils;
15#[cfg(test)]
⋯4 lines
imports pty_utils::pty_pair tests.rs · lines 1–18
1#![allow(clippy::unwrap_used)]
2
3use super::*;
4use pty_utils::pty_pair;
5use std::env;
6use std::io::Write;
7
8#[test]
9fn ttyname_r_returns_successfully() {
10 let pty = pty_pair().unwrap();
⋯8 lines
Calls native open or sys_open tests.rs · lines 20–35
20:2… let mut tty = reopen_tty(pty.user.as_fd()).unwrap();
21 tty.write_all(b"foo").unwrap();
22}
23
24#[test]
25fn is_read_write_returns_true_for_read_write_fd() {
26 let file = OpenOptions::new()
27 .read(true)
28 .write(true)
29 .open("/dev/null")
30 .unwrap();
31 assert!(is_read_write(file.as_fd()).unwrap());
⋯4 lines
imports libc::grantpt pty_utils.rs · lines 1–15
1use libc::{grantpt, posix_openpt, unlockpt, O_CLOEXEC, O_NOCTTY, O_RDWR};
2use std::ffi::{c_int, CStr, CString, OsStr};
3use std::fs::File;
4use std::io;
5use std::os::fd::{AsFd as _, AsRawFd as _, BorrowedFd, FromRawFd as _, OwnedFd};
6use std::os::unix::ffi::OsStrExt;
7
8pub(crate) fn pty_pair() -> io::Result<PtyPair> {
9 let controlling = openpty()?;
10 let user = File::open(OsStr::from_bytes(
11 ptsname_r(controlling.as_fd())?.as_bytes(),
12 ))?
13 .into();
14 Ok(PtyPair {
15 _controllin …

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.