From 9264a00dfd13c18350bbc45a688e4af0fe5fcf6a Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Sun, 22 Jul 2018 18:56:57 +0530 Subject: [PATCH] Simplify EnsureProcessTerminated() implementations. https://chromium-review.googlesource.com/c/chromium/src/+/920799 --- atom/common/platform_util_linux.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/atom/common/platform_util_linux.cc b/atom/common/platform_util_linux.cc index 8fad8609342a..63ee0bdcefbb 100644 --- a/atom/common/platform_util_linux.cc +++ b/atom/common/platform_util_linux.cc @@ -32,16 +32,15 @@ bool XDGUtilV(const std::vector& argv, const bool wait_for_exit) { if (!process.IsValid()) return false; - if (!wait_for_exit) { - base::EnsureProcessGetsReaped(process.Pid()); - return true; + if (wait_for_exit) { + int exit_code = -1; + if (!process.WaitForExit(&exit_code)) + return false; + return (exit_code == 0); } - int exit_code = -1; - if (!process.WaitForExit(&exit_code)) - return false; - - return (exit_code == 0); + base::EnsureProcessGetsReaped(std::move(process)); + return true; } bool XDGUtil(const std::string& util,