mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 20:25:12 -05:00
refactor: StdFileResource
- remove unused cancel handle (#14558)
This commit is contained in:
parent
30841a1705
commit
75f373dd42
1 changed files with 2 additions and 11 deletions
|
@ -301,11 +301,9 @@ impl Resource for ChildStderrResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub struct StdFileResource {
|
pub struct StdFileResource {
|
||||||
fs_file: Option<Arc<Mutex<StdFile>>>,
|
fs_file: Option<Arc<Mutex<StdFile>>>,
|
||||||
metadata: RefCell<FileMetadata>,
|
metadata: RefCell<FileMetadata>,
|
||||||
cancel: CancelHandle,
|
|
||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,18 +311,16 @@ impl StdFileResource {
|
||||||
pub fn stdio(std_file: &StdFile, name: &str) -> Self {
|
pub fn stdio(std_file: &StdFile, name: &str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
fs_file: std_file.try_clone().map(|s| Arc::new(Mutex::new(s))).ok(),
|
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(),
|
name: name.to_string(),
|
||||||
..Default::default()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fs_file(fs_file: StdFile) -> Self {
|
pub fn fs_file(fs_file: StdFile) -> Self {
|
||||||
Self {
|
Self {
|
||||||
fs_file: Some(Arc::new(Mutex::new(fs_file))),
|
fs_file: Some(Arc::new(Mutex::new(fs_file))),
|
||||||
metadata: RefCell::new(FileMetadata::default()),
|
metadata: Default::default(),
|
||||||
name: "fsFile".to_string(),
|
name: "fsFile".to_string(),
|
||||||
..Default::default()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,11 +401,6 @@ impl Resource for StdFileResource {
|
||||||
fn write(self: Rc<Self>, buf: ZeroCopyBuf) -> AsyncResult<usize> {
|
fn write(self: Rc<Self>, buf: ZeroCopyBuf) -> AsyncResult<usize> {
|
||||||
Box::pin(self.write(buf))
|
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
|
// override op_print to use the stdout and stderr in the resource table
|
||||||
|
|
Loading…
Add table
Reference in a new issue