Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed HTTP server error and auto increment port in command line 256 & 239. #262

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions bin/reload
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@ if (typeof program.watchDir === 'undefined') {
program.watchDir = program.dir
}

var args = ['-e', program.exts, '-w', program.watchDir, '-q', '--', serverFile, program.port, program.dir, !!program.browser, program.hostname, runFile, program.startPage, program.fallback, program.verbose]
supervisor.run(args)
var args
var start = function () {
args = ['-e', program.exts, '-w', program.watchDir, '-n', 'exit', '-q', '--', serverFile, program.port, program.dir, !!program.browser, program.hostname, runFile, program.startPage, program.fallback, program.verbose]
supervisor.run(args)

console.log('\nReload web server:')
console.log('listening on port ' + clc.blue.bold(program.port))
console.log('monitoring dir ' + clc.green.bold(program.dir))
console.log('\nReload web server:')
console.log('listening on port ' + clc.blue.bold(program.port))
console.log('monitoring dir ' + clc.green.bold(program.dir))

supervisor.child.on('exit', function () {
program.port++
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an on by default flag option for the auto increment?

start()
})
}
start()
5 changes: 4 additions & 1 deletion lib/reload-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ var server = http.createServer(function (req, res) {
} else { // Serve any other file using serve-static
serve(req, res, finalhandler(req, res))
}
}).on('error', function (err) {
console.error(err.message)
process.exit()
})

// Reload call and configurations. Stub app as it isn't used here
reload(function () {}, reloadOpts, server).then(function (reload) {
reload(function () { }, reloadOpts, server).then(function (reload) {
reloadReturned = reload
server.listen(port, function () {
// Reload writes a random temp file which is checked on a reload so that the browser is not opened every time a change is made
Expand Down