mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tweak to LEDborg to use fs.exists rather than fs.read... no need to read and catch exception
This commit is contained in:
parent
052aad50e6
commit
0878071a91
@ -18,9 +18,11 @@ var RED = require("../../red/red");
|
|||||||
var util = require('util');
|
var util = require('util');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
// read from /dev/ledborg to see if it exists - if not then don't even show the node.
|
// check if /dev/ledborg exists - if not then don't even show the node.
|
||||||
try { var rc = fs.readFileSync("/dev/ledborg"); }
|
if (!fs.existsSync("/dev/ledborg")) {
|
||||||
catch (err) { util.log("[77-ledborg.js] Error: PiBorg hardware : LedBorg not found"); return; }
|
util.log("[78-ledborg.js] Error: PiBorg hardware : LedBorg not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
function LedBorgNode(n) {
|
function LedBorgNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
|
Loading…
Reference in New Issue
Block a user