mikros: Fix reporting 0 bytes read when STDOUT/ERR is written with no open FD

This commit is contained in:
pjht 2024-11-03 11:06:43 -06:00
parent dbfeb119b5
commit f4f2e55ee6
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -46,7 +46,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
//} //}
//Ok(buf.len()) //Ok(buf.len())
let Some(fd) = *STDOUT_FD.get().unwrap() else { let Some(fd) = *STDOUT_FD.get().unwrap() else {
return Ok(0); return Ok(buf.len());
}; };
let file = File { fs_pid: fd.0, fd: fd.1 }; let file = File { fs_pid: fd.0, fd: fd.1 };
let res = file.write(buf); let res = file.write(buf);
@ -74,7 +74,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
//} //}
//Ok(buf.len()) //Ok(buf.len())
let Some(fd) = *STDERR_FD.get().unwrap() else { let Some(fd) = *STDERR_FD.get().unwrap() else {
return Ok(0); return Ok(buf.len());
}; };
let file = File { fs_pid: fd.0, fd: fd.1 }; let file = File { fs_pid: fd.0, fd: fd.1 };
let res = file.write(buf); let res = file.write(buf);