This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sys = require('sys'), | |
| spawn = require('child_process').spawn, | |
| ls = spawn('ls', ['-lh', '/usr']); | |
| ls.stdout.addListener('data', function (data) { | |
| sys.print('stdout: ' + data); | |
| }); | |
| ls.stderr.addListener('data', function (data) { | |
| sys.print('stderr: ' + data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var child_process = require('child_process'), | |
| sys = require('sys'), | |
| net = require('net'), | |
| netBinding = process.binding('net'); | |
| var fd = netBinding.socket('tcp4'); | |
| netBinding.bind(fd, 8080); | |
| netBinding.listen(fd, 128); | |
| for (var i = 0; i < 4; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in REPL | |
| var exec = require('child_process').exec; | |
| var child; | |
| var uid = 123; | |
| child = exec('id -u root', function(error, stdout, stderr) { | |
| uid = parseInt(stdout, 10); |