Skip to content

Commit

Permalink
linux can't read error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joeferner committed Apr 25, 2012
1 parent 18ca6c0 commit d3251dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/serialport.js
Expand Up @@ -109,7 +109,7 @@ function listUnix (callback) {
if (err) {
// if this directory is not found this could just be because it's not plugged in
if (err.errno === 34) {
callback(null, []);
return callback(null, []);
}
return console.log(err);
}
Expand Down
10 changes: 7 additions & 3 deletions test/listTest.js
Expand Up @@ -7,8 +7,12 @@ serialport.list(function (err, results) {
if (err) {
throw err;
}
for (var i = 0; i < results.length; i++) {
var item = results[i];
console.log(item.comName, '-', item.manufacturer, '-', item.pnpId);
if (results.length === 0) {
console.log("No ports found");
} else {
for (var i = 0; i < results.length; i++) {
var item = results[i];
console.log(item.comName, '-', item.manufacturer, '-', item.pnpId);
}
}
});

0 comments on commit d3251dd

Please sign in to comment.