mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Use environment variable to set path for nodes....
This commit is contained in:
parent
f1bc8c3f56
commit
5ec8147eb1
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
var RED = require("../../red/red");
|
||||
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
||||
var util = require("util");
|
||||
var exec = require('child_process').exec;
|
||||
var fs = require('fs');
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
var RED = require("../../red/red");
|
||||
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
||||
var util = require('util');
|
||||
var fs = require('fs');
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
var RED = require("../../red/red");
|
||||
|
||||
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
||||
var spawn = require('child_process').spawn;
|
||||
var plat = require('os').platform();
|
||||
|
||||
@ -30,7 +31,6 @@ function PingNode(n) {
|
||||
else if (plat == "darwin") ex = spawn('ping', ['-n', '-t 5', '-c 1', node.host]);
|
||||
else node.error("Sorry - your platform - "+plat+" - is not recognised.");
|
||||
var res="";
|
||||
|
||||
ex.stdout.on('data', function (data) {
|
||||
//console.log('[ping] stdout: ' + data.toString());
|
||||
var regex = /time=(.*)ms/;
|
||||
@ -46,12 +46,12 @@ function PingNode(n) {
|
||||
if (code == 0) msg = { payload: res, topic:node.host };
|
||||
node.send(msg);
|
||||
});
|
||||
|
||||
}, node.timer);
|
||||
|
||||
this.on("close", function() {
|
||||
clearInterval(this.tout);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
RED.nodes.registerType("ping",PingNode);
|
||||
|
||||
PingNode.prototype.close = function() {
|
||||
clearInterval(this.tout);
|
||||
}
|
||||
|
@ -13,7 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
var RED = require("../../red/red");
|
||||
|
||||
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
||||
var SunCalc = require('suncalc');
|
||||
|
||||
function SunNode(n) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user