From 8b75198dd82b37316ebfbe72c919890980e60ea9 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Sat, 15 Mar 2014 03:12:04 +0900 Subject: [PATCH] Make it not fail if it can't find /etc/resolv.conf On OSX /etc/resolv.conf is generated by the OS anytime the network changes. If I create a network "By picking 'Create Network...'" from the wifi menu then there is no /etc/resolv.conf and the throw that was here would .. uh, .. throw. Making it not throw makes the dns-server work for my purposes. --- lib/platform.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/platform.js b/lib/platform.js index 0462346..5ab6461 100644 --- a/lib/platform.js +++ b/lib/platform.js @@ -163,9 +163,12 @@ Platform.prototype.parseResolv = function() { fs.readFile('/etc/resolv.conf', 'ascii', function(err, file) { if (err) { + // If the file wasn't found don't worry about it. + if (err.code == 'ENOENT') { + return; + } throw err; } - file.split(/\n/).forEach(function(line) { var i, parts, subparts; line = line.replace(/^\s+|\s+$/g, '');