Skip to content

Commit

Permalink
Make it not fail if it can't find /etc/resolv.conf
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
greggman committed Jun 26, 2014
1 parent 03561d0 commit 8b75198
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '');
Expand Down

0 comments on commit 8b75198

Please sign in to comment.