mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Change regex for Ping node to work across languages...
(hopefully) Addresses Issue #80
This commit is contained in:
parent
f7c7c52578
commit
ebbd9f4494
@ -34,9 +34,13 @@ module.exports = function(RED) {
|
|||||||
var res = false;
|
var res = false;
|
||||||
ex.stdout.on('data', function (data) {
|
ex.stdout.on('data', function (data) {
|
||||||
//console.log('[ping] stdout: ' + data.toString());
|
//console.log('[ping] stdout: ' + data.toString());
|
||||||
var regex = /from.*time.(.*)ms/;
|
var regex = /=.*[<|=]([0-9]*).*TTL|ttl..*=([0-9]*)/;
|
||||||
|
//var regex = /from.*time.(.*)ms/;
|
||||||
var m = regex.exec(data.toString())||"";
|
var m = regex.exec(data.toString())||"";
|
||||||
if (m !== '') { res = Number(m[1]); }
|
if (m !== '') {
|
||||||
|
if (m[1]) { res = Number(m[1]); }
|
||||||
|
if (m[2]) { res = Number(m[2]); }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
ex.stderr.on('data', function (data) {
|
ex.stderr.on('data', function (data) {
|
||||||
//console.log('[ping] stderr: ' + data);
|
//console.log('[ping] stderr: ' + data);
|
||||||
|
Loading…
Reference in New Issue
Block a user