mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-17 15:34:18 +08:00
Remove dependency on filedescriptor crate
This commit is contained in:
parent
bee7a9d5c4
commit
28a46f7512
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -471,17 +471,6 @@ version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
|
||||
|
||||
[[package]]
|
||||
name = "filedescriptor"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"thiserror 1.0.69",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.5"
|
||||
@ -490,9 +479,9 @@ checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.5"
|
||||
version = "1.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb"
|
||||
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
@ -929,7 +918,6 @@ dependencies = [
|
||||
"ansi-to-tui",
|
||||
"anyhow",
|
||||
"blake3 1.5.3",
|
||||
"filedescriptor",
|
||||
"globset",
|
||||
"ignore",
|
||||
"libc",
|
||||
@ -1322,7 +1310,7 @@ version = "1.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"cfg-if 1.0.4",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ doctest = false
|
||||
[features]
|
||||
#TODO: Actually make without tui feature works
|
||||
default = ["tui"]
|
||||
tui = ["ratatui", "ansi-to-tui", "filedescriptor", "strip-ansi-escapes"]
|
||||
tui = ["ratatui", "ansi-to-tui", "strip-ansi-escapes"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
@ -49,7 +49,6 @@ serde = { version = "=1.0.197", features = ["derive"] }
|
||||
termion = "4"
|
||||
toml = "0.8"
|
||||
walkdir = "2.3.1"
|
||||
filedescriptor = { version = "0.8.3", optional = true }
|
||||
ansi-to-tui = { version = "7.0.0", optional = true }
|
||||
strip-ansi-escapes = { version = "0.2.1", optional = true }
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use anyhow::{Error, bail};
|
||||
use filedescriptor::FileDescriptor;
|
||||
use libc::{self, winsize};
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write};
|
||||
use std::os::fd::FromRawFd;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
@ -135,10 +135,10 @@ fn openpty(size: PtySize) -> anyhow::Result<(UnixMasterPty, UnixSlavePty)> {
|
||||
}
|
||||
|
||||
let master = UnixMasterPty {
|
||||
fd: PtyFd(unsafe { FileDescriptor::from_raw_fd(master) }),
|
||||
fd: PtyFd(unsafe { File::from_raw_fd(master) }),
|
||||
};
|
||||
let slave = UnixSlavePty {
|
||||
fd: PtyFd(unsafe { FileDescriptor::from_raw_fd(slave) }),
|
||||
fd: PtyFd(unsafe { File::from_raw_fd(slave) }),
|
||||
};
|
||||
|
||||
// Ensure that these descriptors will get closed when we execute
|
||||
@ -168,18 +168,13 @@ impl UnixPtySystem {
|
||||
}
|
||||
}
|
||||
|
||||
struct PtyFd(pub FileDescriptor);
|
||||
struct PtyFd(pub File);
|
||||
impl std::ops::Deref for PtyFd {
|
||||
type Target = FileDescriptor;
|
||||
fn deref(&self) -> &FileDescriptor {
|
||||
type Target = File;
|
||||
fn deref(&self) -> &File {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
impl std::ops::DerefMut for PtyFd {
|
||||
fn deref_mut(&mut self) -> &mut FileDescriptor {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Read for PtyFd {
|
||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
|
||||
@ -249,8 +244,8 @@ impl PtyFd {
|
||||
unsafe {
|
||||
cmd
|
||||
// .stdin(self.as_stdio()?)
|
||||
.stdout(self.as_stdio()?)
|
||||
.stderr(self.as_stdio()?)
|
||||
.stdout(self.try_clone()?)
|
||||
.stderr(self.try_clone()?)
|
||||
.pre_exec(move || {
|
||||
// Clean up a few things before we exec the program
|
||||
// Clear out any potentially problematic signal
|
||||
|
||||
Loading…
Reference in New Issue
Block a user