]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix console.log under Windows.
authorCheng Zhao <zcbenz@gmail.com>
Sun, 29 Dec 2013 14:32:26 +0000 (22:32 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Sun, 29 Dec 2013 14:32:26 +0000 (22:32 +0800)
The process.log is not added until the next iteration of uv loop.

browser/lib/init.coffee

index 551efffdeee65c906772d80831861d0428c78f10..d16450f701f47bdf56e5dd66065b5e933a813594 100644 (file)
@@ -9,18 +9,6 @@ process.resourcesPath = path.resolve process.argv[1], '..', '..', '..'
 # we need to restore it here.
 process.argv.splice 1, 1
 
-if process.platform is 'win32'
-  # Redirect node's console to use our own implementations, since node can not
-  # handle output when running as GUI program.
-  console.log = console.error = console.warn = process.log
-  process.stdout.write = process.stderr.write = process.log
-
-  # Always returns EOF for stdin stream.
-  Readable = require('stream').Readable
-  stdin = new Readable
-  stdin.push null
-  process.__defineGetter__ 'stdin', -> stdin
-
 # Add browser/api/lib to require's search paths,
 # which contains javascript part of Atom's built-in libraries.
 globalPaths = require('module').globalPaths
@@ -32,6 +20,18 @@ globalPaths.push path.join process.resourcesPath, 'common', 'api', 'lib'
 # Do loading in next tick since we still need some initialize work before
 # native bindings can work.
 setImmediate ->
+  if process.platform is 'win32'
+    # Redirect node's console to use our own implementations, since node can not
+    # handle console output when running as GUI program.
+    console.log = console.error = console.warn = process.log
+    process.stdout.write = process.stderr.write = process.log
+
+    # Always returns EOF for stdin stream.
+    Readable = require('stream').Readable
+    stdin = new Readable
+    stdin.push null
+    process.__defineGetter__ 'stdin', -> stdin
+
   # Don't quit on fatal error.
   process.on 'uncaughtException', (error) ->
     # Show error in GUI.