From: Bjørn Erik Pedersen Date: Sat, 27 Feb 2016 15:58:42 +0000 (+0100) Subject: Do not try to find available port if set by user X-Git-Tag: v0.16~308 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9349a889e2bf6262681164f41c9221a382fd57ae;p=brevno-suite%2Fhugo Do not try to find available port if set by user He/she probably really meant it. Fixes #1901 --- diff --git a/commands/server.go b/commands/server.go index 94d155ab..53c38099 100644 --- a/commands/server.go +++ b/commands/server.go @@ -118,6 +118,10 @@ func server(cmd *cobra.Command, args []string) error { if err == nil { l.Close() } 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") sp, err := helpers.FindAvailablePort() if err != nil {