Blob Blame History Raw
From 008149e3576aa8d13c6831ee0c1d25c3c23deb83 Mon Sep 17 00:00:00 2001
From: Colin Snover <github.com@zetafleet.com>
Date: Thu, 14 Dec 2017 14:30:16 -0600
Subject: [PATCH 2/2] POSIX: Do not hang ScummVM when opening a browser

If the call used to open the browser does not return until the
browser is closed, this would previously cause ScummVM to hang.
Since we are using waitpid now, we can avoid hanging by telling
waitpid to not block on a child which has not exited.
---
 backends/platform/sdl/posix/posix.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 60f85efc2f..b01de2d240 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -320,7 +320,7 @@ bool OSystem_POSIX::launchBrowser(const Common::String &client, const Common::St
 	if (posix_spawnp(&pid, client.c_str(), NULL, NULL, const_cast<char **>(argv), environ) != 0) {
 		return false;
 	}
-	return (waitpid(pid, NULL, 0) != -1);
+	return (waitpid(pid, NULL, WNOHANG) != -1);
 }
 
 AudioCDManager *OSystem_POSIX::createAudioCDManager() {
-- 
2.14.3