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,