Skip to content

Commit bcda407

Browse files
committed
fixed servedir listening to streaming servers
1 parent 329f4d3 commit bcda407

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

bin/servedir

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ fs.realpath(__filename, function(error, script) {
5454
testPort = servedir.defaultPort;
5555
// try to check if anything is running on the default port, and increment until it's free
5656
var next = function () {
57-
http.get(parse('http://localhost:' + testPort + '/'), function (req) {
58-
req.on('end', function () {
59-
testPort++;
60-
next();
61-
});
57+
var request = http.get(parse('http://localhost:' + testPort + '/'), function (res) {
58+
res.destroy();
59+
testPort++;
60+
next();
6261
}).on('error', function () {
6362
port = testPort;
6463
run();

0 commit comments

Comments
 (0)