mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Do not try to find available port if set by user
He/she probably really meant it. Fixes #1901
This commit is contained in:
parent
ff4ca99286
commit
9349a889e2
1 changed files with 4 additions and 0 deletions
|
@ -118,6 +118,10 @@ func server(cmd *cobra.Command, args []string) error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
l.Close()
|
l.Close()
|
||||||
} else {
|
} else {
|
||||||
|
if flagChanged(serverCmd.Flags(), "port") {
|
||||||
|
// port set explicitly by user -- he/she probably meant it!
|
||||||
|
return newSystemErrorF("Port %d already in use", serverPort)
|
||||||
|
}
|
||||||
jww.ERROR.Println("port", serverPort, "already in use, attempting to use an available port")
|
jww.ERROR.Println("port", serverPort, "already in use, attempting to use an available port")
|
||||||
sp, err := helpers.FindAvailablePort()
|
sp, err := helpers.FindAvailablePort()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue