]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix using common modules.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 30 Jun 2014 02:06:10 +0000 (10:06 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 30 Jun 2014 02:06:10 +0000 (10:06 +0800)
atom/common/lib/init.coffee

index 35ad5e512d924c2f34ef6041dd11b1faf30aefd4..5da02744275bf432aa04fd26204720ada5c4053c 100644 (file)
@@ -2,7 +2,11 @@ path   = require 'path'
 timers = require 'timers'
 Module = require 'module'
 
-process.atomBinding = (name) -> process.binding "atom_#{process.type}_#{name}"
+process.atomBinding = (name) ->
+  try
+    process.binding "atom_#{process.type}_#{name}"
+  catch e
+    process.binding "atom_common_#{name}" if e.message is 'No such module'
 
 # Add common/api/lib to module search paths.
 globalPaths = Module.globalPaths