From: Cheng Zhao Date: Sun, 29 Mar 2015 12:32:23 +0000 (+0800) Subject: It is not safe to get exit code once the child is reaped X-Git-Tag: v0.22.3~6 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=b987656f1f7234267684df3b67e08896db9d3aac;p=electron.git It is not safe to get exit code once the child is reaped Continues #1311. --- diff --git a/atom/common/platform_util_linux.cc b/atom/common/platform_util_linux.cc index d1173c6f..f70d16a5 100644 --- a/atom/common/platform_util_linux.cc +++ b/atom/common/platform_util_linux.cc @@ -26,16 +26,15 @@ bool XDGUtil(const std::string& util, const std::string& arg) { // bring up a new terminal if necessary. See "man mailcap". options.environ["MM_NOTTTY"] = "1"; - base::ProcessHandle handle; - if (base::LaunchProcess(argv, options, &handle)) { - int exit_code; - base::Process process(handle); - base::EnsureProcessGetsReaped(handle); - process.WaitForExit(&exit_code); - return (exit_code == 0); - } - - return false; + base::Process process = base::LaunchProcess(argv, options); + if (!process.IsValid()) + return false; + + int exit_code = -1; + if (!process.WaitForExit(&exit_code)) + return false; + + return (exit_code == 0); } void XDGOpen(const std::string& path) {