From f4eaecdf949edddb4d32a62a7f276247a963ef05 Mon Sep 17 00:00:00 2001 From: Grzegorz Bartoszek Date: Wed, 6 Sep 2023 14:44:50 +0200 Subject: [PATCH] Apply review suggestions --- lib/wasix/src/syscalls/wasix/proc_join.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/wasix/src/syscalls/wasix/proc_join.rs b/lib/wasix/src/syscalls/wasix/proc_join.rs index aa18a92adfa..4154ae3c8f2 100644 --- a/lib/wasix/src/syscalls/wasix/proc_join.rs +++ b/lib/wasix/src/syscalls/wasix/proc_join.rs @@ -182,13 +182,13 @@ pub(super) fn proc_join_internal( } )); - if flags & JoinFlags::NON_BLOCKING != JoinFlags::from_bits_preserve(0) { - return if let Some(status) = process.try_join() { + if flags.contains(JoinFlags::NON_BLOCKING) { + if let Some(status) = process.try_join() { let exit_code = status.unwrap_or_else(|_| Errno::Child.into()); ret_result(ctx, JoinStatusResult::ExitNormal(pid, exit_code)) } else { ret_result(ctx, JoinStatusResult::Nothing) - }; + } } else { // Wait for the process to finish let process2 = process.clone(); @@ -201,13 +201,13 @@ pub(super) fn proc_join_internal( JoinStatusResult::ExitNormal(pid, exit_code) }, )?; - return match res { + match res { AsyncifyAction::Finish(ctx, result) => ret_result(ctx, result), AsyncifyAction::Unwind => Ok(Errno::Success), - }; + } } + } else { + trace!(ret_id = pid.raw(), "status=nothing"); + ret_result(ctx, JoinStatusResult::Nothing) } - - trace!(ret_id = pid.raw(), "status=nothing"); - ret_result(ctx, JoinStatusResult::Nothing) }