extra fix for $DISPLAY parsing

This commit is contained in:
Andrey Sidorov 2011-12-16 09:36:00 +11:00
parent e305b729f3
commit f2f52d92f9

View file

@ -301,7 +301,7 @@ XClient.prototype.startHandshake = function()
handshake.writeClientHello(this.pack_stream, this.displayNum, this.authHost);
handshake.readServerHello(this.pack_stream, function(display)
{
// TODO: readServerHello can set erro state in display
// TODO: readServerHello can set error state in display
// emit error in that case
client.expectReplyHeader();
client.display = display;
@ -316,17 +316,6 @@ XClient.prototype.require = function(extName, callback)
ext.requireExt(this.display, callback);
}
var platformLocalTransport = {
win32: 'tcp',
win64: 'tcp',
cygwin: 'tcp',
linux: 'unix',
// OSX
darwin: 'unix'
// TODO: check process.platform on SmartMachine solaris box
}
module.exports.createClient = function(initCb, display)
{
if (!display)
@ -349,11 +338,14 @@ module.exports.createClient = function(initCb, display)
// open stream
var stream;
var socketPath;
if ( process.platform.match(/win/).length > 0 )
// try local socket on non-windows platforms
if ( ['cygwin', 'win32', 'win64'].indexOf(process.platform) < 0 )
{
if (process.platform == 'darwin')
{
if (display[0] == '/') // local socket
// socket path on OSX is /tmp/launch-(some id)/org.x:0
if (display[0] == '/')
{
socketPath = display;
}