1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

refactor: StdFileResource - remove unused cancel handle (#14558)

This commit is contained in:
David Sherret 2022-05-10 17:36:58 -04:00 committed by GitHub
parent 30841a1705
commit 75f373dd42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -301,11 +301,9 @@ impl Resource for ChildStderrResource {
}
}
#[derive(Default)]
pub struct StdFileResource {
fs_file: Option<Arc<Mutex<StdFile>>>,
metadata: RefCell<FileMetadata>,
cancel: CancelHandle,
name: String,
}
@ -313,18 +311,16 @@ impl StdFileResource {
pub fn stdio(std_file: &StdFile, name: &str) -> Self {
Self {
fs_file: std_file.try_clone().map(|s| Arc::new(Mutex::new(s))).ok(),
metadata: RefCell::new(FileMetadata::default()),
metadata: Default::default(),
name: name.to_string(),
..Default::default()
}
}
pub fn fs_file(fs_file: StdFile) -> Self {
Self {
fs_file: Some(Arc::new(Mutex::new(fs_file))),
metadata: RefCell::new(FileMetadata::default()),
metadata: Default::default(),
name: "fsFile".to_string(),
..Default::default()
}
}
@ -405,11 +401,6 @@ impl Resource for StdFileResource {
fn write(self: Rc<Self>, buf: ZeroCopyBuf) -> AsyncResult<usize> {
Box::pin(self.write(buf))
}
fn close(self: Rc<Self>) {
// TODO: do not cancel file I/O when file is writable.
self.cancel.cancel()
}
}
// override op_print to use the stdout and stderr in the resource table