mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-15 00:00:15 +02:00
fs: fix File::from_raw_fd test (#5528)
This commit is contained in:
@@ -184,14 +184,13 @@ async fn unix_fd_is_valid() {
|
||||
#[tokio::test]
|
||||
#[cfg(unix)]
|
||||
async fn read_file_from_unix_fd() {
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::os::unix::io::FromRawFd;
|
||||
use std::os::unix::io::{FromRawFd, IntoRawFd};
|
||||
|
||||
let mut tempfile = tempfile();
|
||||
tempfile.write_all(HELLO).unwrap();
|
||||
|
||||
let file1 = File::open(tempfile.path()).await.unwrap();
|
||||
let raw_fd = file1.as_raw_fd();
|
||||
let raw_fd = file1.into_std().await.into_raw_fd();
|
||||
assert!(raw_fd > 0);
|
||||
|
||||
let mut file2 = unsafe { File::from_raw_fd(raw_fd) };
|
||||
|
||||
Reference in New Issue
Block a user