Activate uv loop when calling childProcess.fork.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 13 Jan 2014 03:52:24 +0000 (11:52 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 13 Jan 2014 03:52:24 +0000 (11:52 +0800)
Fixes #156.

renderer/lib/init.coffee

index 824dbd2c9e8bb1c3ad395052726d4e5d432fd831..84fb257c19b9c8554b9de28b43db65032dc37878 100644 (file)
@@ -37,6 +37,13 @@ process.nextTick = wrapWithActivateUvLoop process.nextTick
 global.setImmediate = wrapWithActivateUvLoop timers.setImmediate
 global.clearImmediate = timers.clearImmediate
 
+# The child_process module also needs to activate the uv loop to make the ipc
+# channel setup.
+# TODO(zcbenz): Find out why this is needed.
+childProcess = require 'child_process'
+childProcess.spawn = wrapWithActivateUvLoop childProcess.spawn
+childProcess.fork = wrapWithActivateUvLoop childProcess.fork
+
 # Set the __filename to the path of html file if it's file:// protocol.
 if window.location.protocol is 'file:'
   global.__filename =