From 7fdba5b51c8a50234574b878b0911ead27526ad9 Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 24 Nov 2024 16:34:00 -0600 Subject: [PATCH] Format --- library/std/src/sys/pal/mikros/process.rs | 57 ++++++++++++++--------- library/std/src/sys/pal/mikros/stdio.rs | 6 +-- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/library/std/src/sys/pal/mikros/process.rs b/library/std/src/sys/pal/mikros/process.rs index 6a2ca86d9a6..0294c95dd2d 100644 --- a/library/std/src/sys/pal/mikros/process.rs +++ b/library/std/src/sys/pal/mikros/process.rs @@ -110,39 +110,54 @@ pub fn spawn( let stdin = match self.stdin.take() { Some(Stdio::Null) => None, None | Some(Stdio::Inherit) => { - STDIN.get().unwrap().as_ref().map(|file| { - let file = file.duplicate()?; - let res = Ok::<_, io::Error>((file.fs_pid, file.fd)); - crate::mem::drop(file); // do not close the temporary file struct - res - }).transpose()? - }, + STDIN + .get() + .unwrap() + .as_ref() + .map(|file| { + let file = file.duplicate()?; + let res = Ok::<_, io::Error>((file.fs_pid, file.fd)); + crate::mem::drop(file); // do not close the temporary file struct + res + }) + .transpose()? + } Some(Stdio::MakePipe) => todo!(), Some(Stdio::InheritFile(file)) => Some((file.fs_pid, file.fd)), }; let stdout = match self.stdout.take() { Some(Stdio::Null) => None, None | Some(Stdio::Inherit) => { - STDOUT.get().unwrap().as_ref().map(|file| { - let file = file.duplicate()?; - let res = Ok::<_, io::Error>((file.fs_pid, file.fd)); - crate::mem::drop(file); // do not close the temporary file struct - res - }).transpose()? - }, + STDOUT + .get() + .unwrap() + .as_ref() + .map(|file| { + let file = file.duplicate()?; + let res = Ok::<_, io::Error>((file.fs_pid, file.fd)); + crate::mem::drop(file); // do not close the temporary file struct + res + }) + .transpose()? + } Some(Stdio::MakePipe) => todo!(), Some(Stdio::InheritFile(file)) => Some((file.fs_pid, file.fd)), }; let stderr = match self.stderr.take() { Some(Stdio::Null) => None, None | Some(Stdio::Inherit) => { - STDERR.get().unwrap().as_ref().map(|file| { - let file = file.duplicate()?; - let res = Ok::<_, io::Error>((file.fs_pid, file.fd)); - crate::mem::drop(file); // do not close the temporary file struct - res - }).transpose()? - }, + STDERR + .get() + .unwrap() + .as_ref() + .map(|file| { + let file = file.duplicate()?; + let res = Ok::<_, io::Error>((file.fs_pid, file.fd)); + crate::mem::drop(file); // do not close the temporary file struct + res + }) + .transpose()? + } Some(Stdio::MakePipe) => todo!(), Some(Stdio::InheritFile(file)) => Some((file.fs_pid, file.fd)), }; diff --git a/library/std/src/sys/pal/mikros/stdio.rs b/library/std/src/sys/pal/mikros/stdio.rs index 85311930531..be9162ac04c 100644 --- a/library/std/src/sys/pal/mikros/stdio.rs +++ b/library/std/src/sys/pal/mikros/stdio.rs @@ -97,7 +97,7 @@ pub fn init() { }; let stdio: [Option<(u64, u64)>; 3] = postcard::from_bytes(&rpc::send_call(proc_man_pid, 8, 1, &[]).get_return()).unwrap(); - STDIN.get_or_init(|| stdio[0].map(|(fs_pid, fd)| File{fs_pid, fd})); - STDOUT.get_or_init(|| stdio[1].map(|(fs_pid, fd)| File{fs_pid, fd})); - STDERR.get_or_init(|| stdio[2].map(|(fs_pid, fd)| File{fs_pid, fd})); + STDIN.get_or_init(|| stdio[0].map(|(fs_pid, fd)| File { fs_pid, fd })); + STDOUT.get_or_init(|| stdio[1].map(|(fs_pid, fd)| File { fs_pid, fd })); + STDERR.get_or_init(|| stdio[2].map(|(fs_pid, fd)| File { fs_pid, fd })); }