From 170b640bcfc9b913201638b8024ca636d49e2371 Mon Sep 17 00:00:00 2001 From: Ryan Gonzalez Date: Tue, 31 Oct 2023 05:02:17 -0500 Subject: [PATCH] Fix `Process.exists?` throwing errors on EPERM (#13911) --- src/crystal/system/unix/process.cr | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/crystal/system/unix/process.cr b/src/crystal/system/unix/process.cr index f07a91806857..0d4b3c1a9235 100644 --- a/src/crystal/system/unix/process.cr +++ b/src/crystal/system/unix/process.cr @@ -79,8 +79,14 @@ struct Crystal::System::Process if ret == 0 true else - return false if Errno.value == Errno::ESRCH - raise RuntimeError.from_errno("kill") + case Errno.value + when Errno::EPERM + true + when Errno::ESRCH + false + else + raise RuntimeError.from_errno("kill") + end end end