Created
January 23, 2011 15:10
-
-
Save DanBUK/792135 to your computer and use it in GitHub Desktop.
Chroot'ed node processes!
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
root 31098 0.0 0.5 15500 2180 pts/1 S 14:15 0:00 | \_ -bash | |
dan 31361 0.2 2.3 626500 8964 pts/1 Sl+ 15:08 0:00 | \_ node sandbox_it.js | |
[dan@arch-vm node-daemon-tools]$ curl http://127.0.0.1:8124/ | |
Hello World | |
Current directory: / | |
err: null | |
files: [ 'hello.js' ] | |
[root@arch-vm ~]# cat hello/hello.js | |
var sys = require('sys'); | |
var fs = require('fs'); | |
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.write('Hello World\n'); | |
var buff = ""; | |
fs.readdir("./", function (err, files) { | |
buff += 'Current directory: ' + process.cwd() + '\n'; | |
buff += 'err: ' + sys.inspect(err) + '\n'; | |
buff += 'files: ' + sys.inspect(files) + '\n'; | |
res.end(buff); | |
}); | |
}).listen(8124); | |
console.log('Server running at port 8124'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment