Skip to content

Commit

Permalink
Parse the port to a number if needed, further fixing #524 (#526)
Browse files Browse the repository at this point in the history
* Parse the port to a number if needed, further fixing #524

* Fix the reassignment of program.port
  • Loading branch information
Brandon Konkle authored and KyleAMathews committed Oct 31, 2016
1 parent 031e157 commit 744f85f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/utils/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,19 @@ function startServer (program) {
}

module.exports = (program) => {
detect(program.port, (err, _port) => {
const port = typeof program.port === 'string'
? parseInt(program.port, 10)
: program.port

detect(port, (err, _port) => {
if (err) {
console.error(err)
process.exit()
}

if (program.port !== _port) {
if (port !== _port) {
// eslint-disable-next-line max-len
const question = `Something is already running at port ${program.port} \nWould you like to run the app at another port instead? [Y/n] `
const question = `Something is already running at port ${port} \nWould you like to run the app at another port instead? [Y/n] `

return rlInterface.question(question, (answer) => {
if (answer.length === 0 || answer.match(/^yes|y$/i)) {
Expand Down

0 comments on commit 744f85f

Please sign in to comment.