Skip to content

Commit

Permalink
[refactor] replace sys module usages in examples with util
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Sep 2, 2011
1 parent 8ae06c0 commit 227b158
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions examples/chroot.js
@@ -1,14 +1,14 @@
var sys = require('sys'),
var util = require('util'),
daemon = require('daemon'),
fs = require('fs');

daemon.chroot('/tmp/chroot');
sys.puts('Working in chroot');
util.puts('Working in chroot');

setInterval(function () {
fs.readdir('./', function (err, files) {
sys.puts('Current directory: ' + process.cwd());
sys.puts('err: ' + sys.inspect(err));
sys.puts('files: ' + sys.inspect(files));
util.puts('Current directory: ' + process.cwd());
util.puts('err: ' + util.inspect(err));
util.puts('files: ' + util.inspect(files));
});
}, 10000 );
}, 10000 );
4 changes: 2 additions & 2 deletions examples/count-timer.js
Expand Up @@ -6,11 +6,11 @@
*
*/

var sys = require('sys');
var util = require('util');

var count = 0;

var id = setInterval(function () {
sys.puts('Count is ' + count + '. Incrementing now.');
util.puts('Count is ' + count + '. Incrementing now.');
count++;
}, 1000);
4 changes: 2 additions & 2 deletions examples/error-on-timer.js
Expand Up @@ -6,9 +6,9 @@
*
*/

var sys = require('sys');
var util = require('util');

setTimeout(function () {
sys.puts('Throwing error now.');
util.puts('Throwing error now.');
throw new Error('User generated fault.');
}, 200);
4 changes: 2 additions & 2 deletions examples/server.js
@@ -1,4 +1,4 @@
var sys = require('sys'),
var util = require('util'),
http = require('http'),
argv = require('optimist').argv;

Expand All @@ -12,5 +12,5 @@ http.createServer(function (req, res) {
}).listen(port);

/* server started */
sys.puts('> hello world running on port ' + port);
util.puts('> hello world running on port ' + port);

8 changes: 4 additions & 4 deletions examples/spawn-and-error.js
Expand Up @@ -6,21 +6,21 @@
*
*/

var sys = require('sys'),
var util = require('util'),
path = require('path'),
spawn = require('child_process').spawn;

var child = spawn('node', [path.join(__dirname, 'count-timer.js')], { cwd: __dirname });

child.stdout.on('data', function (data) {
sys.puts(data);
util.puts(data);
//throw new Error('User generated fault.');
});

child.stderr.on('data', function (data) {
sys.puts(data);
util.puts(data);
});

child.on('exit', function (code) {
sys.puts('Child process exited with code: ' + code);
util.puts('Child process exited with code: ' + code);
});

0 comments on commit 227b158

Please sign in to comment.