mikros: Do not close stdio after every use
This commit is contained in:
parent
7bd76e861a
commit
5ccb37a3f7
@ -26,8 +26,9 @@ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
return Ok(0);
|
||||
};
|
||||
let file = File { fs_pid: fd.0, fd: fd.1, pos: AtomicUsize::new(0) };
|
||||
let num_bytes = file.read(buf)?;
|
||||
Ok(num_bytes)
|
||||
let res = file.read(buf);
|
||||
crate::mem::drop(file); // do not close the temporary file struct
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +50,9 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
return Ok(0);
|
||||
};
|
||||
let file = File { fs_pid: fd.0, fd: fd.1, pos: AtomicUsize::new(0) };
|
||||
file.write(buf)
|
||||
let res = file.write(buf);
|
||||
crate::mem::drop(file); // do not close the temporary file struct
|
||||
res
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
@ -75,7 +78,9 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
return Ok(0);
|
||||
};
|
||||
let file = File { fs_pid: fd.0, fd: fd.1, pos: AtomicUsize::new(0) };
|
||||
file.write(buf)
|
||||
let res = file.write(buf);
|
||||
crate::mem::drop(file); // do not close the temporary file struct
|
||||
res
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
|
Loading…
Reference in New Issue
Block a user