From bf2c603be7658197591c2d5ecbe637e0f8c7b043 Mon Sep 17 00:00:00 2001 From: sidorares Date: Tue, 2 Aug 2011 14:12:30 +1000 Subject: [PATCH] try to connect with empty auth data if no Xauthority file --- lib/x11/auth.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/x11/auth.js b/lib/x11/auth.js index b9b22c1..c1b7290 100644 --- a/lib/x11/auth.js +++ b/lib/x11/auth.js @@ -67,7 +67,15 @@ module.exports = function( display, host, cb ) } fs.readFile(XAuthorityFile, function (err, data) { - if (err) throw err; + if (err) + { + if (err.code == 'ENOENT') + { + cb('',''); + return; + } + throw err; + } var auth = parseXauth(data); for (cookieNum in auth) @@ -79,8 +87,8 @@ module.exports = function( display, host, cb ) return; } } - throw 'No auth cookie matching display=' + display + ' and host=' + host; - + // throw 'No auth cookie matching display=' + display + ' and host=' + host; + cb( '', '' ); }); } } \ No newline at end of file