From 4b2524141c4da8772276cce6419f76dbf09bd293 Mon Sep 17 00:00:00 2001 From: indexzero Date: Wed, 16 Feb 2011 00:57:55 -0500 Subject: [PATCH] [doc] Added example for chroot --- examples/chroot.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/chroot.js diff --git a/examples/chroot.js b/examples/chroot.js new file mode 100644 index 00000000..5716c497 --- /dev/null +++ b/examples/chroot.js @@ -0,0 +1,14 @@ +var sys = require('sys'), + daemon = require('daemon'), + fs = require('fs'); + +daemon.chroot('/tmp/chroot'); +sys.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)); + }); +}, 10000 ); \ No newline at end of file