mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02: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:
@@ -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 {
|
||||||
|
Reference in New Issue
Block a user