curl after server is listening

This commit is contained in:
Ryan Dahl 2010-04-22 15:48:57 -07:00
parent 76d525b034
commit 11f673e819

View File

@ -9,11 +9,15 @@ s = http.createServer(function (request, response) {
response.end(); response.end();
}) })
s.listen(8000); s.listen(8000);
sys.puts('Server running at http://127.0.0.1:8000/')
childProcess.exec('curl http://127.0.0.1:8000/', function (err, stdout, stderr) { s.addListener('listening', function () {
childProcess.exec('curl http://127.0.0.1:8000/', function (err, stdout, stderr) {
if (err) throw err; if (err) throw err;
s.close(); s.close();
sys.puts('curled response correctly'); sys.puts('curled response correctly');
});
}); });
sys.puts('Server running at http://127.0.0.1:8000/')