Compare commits
2 Commits
201eaf576a
...
c36b14314f
Author | SHA1 | Date | |
---|---|---|---|
c36b14314f | |||
73fd453f55 |
@ -246,7 +246,11 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|||||||
|
|
||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
|
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
|
||||||
if self.0 == 0 { Ok(()) } else { Err(ExitStatusError(self.0)) }
|
if self.0 == 0 {
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(ExitStatusError(self.0))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn code(&self) -> Option<i32> {
|
pub fn code(&self) -> Option<i32> {
|
||||||
@ -314,8 +318,7 @@ pub fn wait(&mut self) -> io::Result<ExitStatus> {
|
|||||||
return unsupported();
|
return unsupported();
|
||||||
};
|
};
|
||||||
let wait_res: Result<(u64, u8), Errno> = postcard::from_bytes(
|
let wait_res: Result<(u64, u8), Errno> = postcard::from_bytes(
|
||||||
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap())
|
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap()).get_return(),
|
||||||
.get_return(),
|
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let (_wait_pid, code) = wait_res?;
|
let (_wait_pid, code) = wait_res?;
|
||||||
@ -327,8 +330,7 @@ pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
|
|||||||
return unsupported();
|
return unsupported();
|
||||||
};
|
};
|
||||||
let wait_res: Result<(u64, u8), Errno> = postcard::from_bytes(
|
let wait_res: Result<(u64, u8), Errno> = postcard::from_bytes(
|
||||||
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap())
|
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap()).get_return(),
|
||||||
.get_return(),
|
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let (_wait_pid, code) = match wait_res {
|
let (_wait_pid, code) = match wait_res {
|
||||||
|
@ -13,6 +13,6 @@ pub extern "C" fn _start() {
|
|||||||
unsafe {
|
unsafe {
|
||||||
asm!("int 0x80", in("rax") 19, lateout("rax") argv, lateout("rcx") argc);
|
asm!("int 0x80", in("rax") 19, lateout("rax") argv, lateout("rcx") argc);
|
||||||
let code = main(argc, argv);
|
let code = main(argc, argv);
|
||||||
crate::sys::os::exit(code);
|
crate::sys::os::exit(code as u8);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user