fix in connection code

This commit is contained in:
Andrey Sidorov 2012-01-20 14:37:08 +11:00
parent 9560f967dc
commit b35752cd28

View file

@ -342,7 +342,8 @@ module.exports.createClient = function(initCb, display)
// try local socket on non-windows platforms // try local socket on non-windows platforms
if ( ['cygwin', 'win32', 'win64'].indexOf(process.platform) < 0 ) if ( ['cygwin', 'win32', 'win64'].indexOf(process.platform) < 0 )
{ {
if (process.platform == 'darwin') console.log(['here1', display, process.platform]);
if (process.platform == 'darwin' || process.platform == 'mac')
{ {
// socket path on OSX is /tmp/launch-(some id)/org.x:0 // socket path on OSX is /tmp/launch-(some id)/org.x:0
if (display[0] == '/') if (display[0] == '/')
@ -352,7 +353,6 @@ module.exports.createClient = function(initCb, display)
} else if(host == '127.0.0.1') } else if(host == '127.0.0.1')
socketPath = '/tmp/.X11-unix/X' + displayNum; socketPath = '/tmp/.X11-unix/X' + displayNum;
} }
socketPath = display;
if(socketPath) if(socketPath)
{ {
stream = net.createConnection(socketPath); stream = net.createConnection(socketPath);