I am running a linux ping command as a child process using the node.js code
below.
The ping command has to be continuous and normally displays the ping result
every second when running in a console.
The last line of code simply pipes the output to the console as if the
command had been issued on a console.
I need to parse the ping results as they come in in node.js.
*Possible Solution :* I think that this can possibly be done by creating a
duplex stream, piping the "ping output" to the duplex stream and reading
on an "available" event.
I cannot get the above working! The first problem I run into is the lack of
documentation on creating an instance for a duplex stream.
==
*var exec = require('child_process').exec,*
* child;*
*child = exec('ping 192.168.1.82',*
* function (error, stdout, stderr) {*
* console.log('stdout: ' + stdout);*
* console.log('stderr: ' + stderr);*
* if (error !== null) {*
* console.log('exec error: ' + error);*
* }*
* });*
*child.stdout.pipe(process.stdout);*
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.