Do not try to find available port if set by user

He/she probably really meant it.

Fixes #1901
This commit is contained in:
Bjørn Erik Pedersen 2016-02-27 16:58:42 +01:00
parent ff4ca99286
commit 9349a889e2

View file

@ -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 {