summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 00:49:20 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 00:49:20 +0000
commit955b73964372469fe35b0162d37f4a357532d6f4 (patch)
treed3e70fb4d2012238be882c6b37fe65d7f50686fe /base
parent1aa3c9c70c57cb1e53113d0eb119e667f3260c8e (diff)
downloadchromium_src-955b73964372469fe35b0162d37f4a357532d6f4.zip
chromium_src-955b73964372469fe35b0162d37f4a357532d6f4.tar.gz
chromium_src-955b73964372469fe35b0162d37f4a357532d6f4.tar.bz2
This change enables ExtensionApiTest.WebSocket on Mac again.
BUG=56596 TEST=none Review URL: http://codereview.chromium.org/6611007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/process_util_posix.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 90c0f96..37b4eeb 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -21,6 +21,7 @@
#include "base/debug/stack_trace.h"
#include "base/dir_reader_posix.h"
#include "base/eintr_wrapper.h"
+#include "base/file_util.h"
#include "base/logging.h"
#include "base/process_util.h"
#include "base/scoped_ptr.h"
@@ -504,6 +505,22 @@ bool LaunchAppImpl(
if (pid == 0) {
// Child process
+ // If a child process uses the readline library, the process block forever.
+ // In BSD like OSes including OS X it is safe to assign /dev/null as stdin.
+ // See http://crbug.com/56596.
+ int null_fd = HANDLE_EINTR(open("/dev/null", O_RDONLY));
+ if (null_fd < 0) {
+ PLOG(ERROR) << "Failed to open /dev/null";
+ return false;
+ } else {
+ file_util::ScopedFD null_fd_closer(&null_fd);
+ int new_fd = HANDLE_EINTR(dup2(null_fd, STDIN_FILENO));
+ if (new_fd != STDIN_FILENO) {
+ PLOG(ERROR) << "Failed to dup /dev/null for stdin";
+ return false;
+ }
+ }
+
if (start_new_process_group) {
// Instead of inheriting the process group ID of the parent, the child
// starts off a new process group with pgid equal to its process ID.