diff --git a/cmd/common-main.go b/cmd/common-main.go index 2c13d2917..b2f2d9956 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -38,6 +38,7 @@ import ( fcolor "github.com/fatih/color" "github.com/go-openapi/loads" + "github.com/inconshreveable/mousetrap" dns2 "github.com/miekg/dns" "github.com/minio/cli" consoleCerts "github.com/minio/console/pkg/certs" @@ -66,6 +67,17 @@ var serverDebugLog = env.Get("_MINIO_SERVER_DEBUG", config.EnableOff) == config. var defaultAWSCredProvider []credentials.Provider func init() { + if runtime.GOOS == "windows" { + if mousetrap.StartedByExplorer() { + fmt.Printf("Don't double-click %s\n", os.Args[0]) + fmt.Println("You need to open cmd.exe/PowerShell and run it from the command line") + fmt.Println("Refer to the docs here on how to run it as a Windows Service https://github.com/minio/minio-service/tree/master/windows") + fmt.Println("Press the Enter Key to Exit") + fmt.Scanln() + os.Exit(1) + } + } + rand.Seed(time.Now().UTC().UnixNano()) logger.Init(GOPATH, GOROOT) diff --git a/go.mod b/go.mod index 8e2e4ad45..bc458809e 100644 --- a/go.mod +++ b/go.mod @@ -32,6 +32,7 @@ require ( github.com/gomodule/redigo v2.0.0+incompatible github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 + github.com/inconshreveable/mousetrap v1.0.0 github.com/jcmturner/gokrb5/v8 v8.4.2 github.com/json-iterator/go v1.1.12 github.com/klauspost/compress v1.13.6 diff --git a/go.sum b/go.sum index 480b1620a..2c9c550d2 100644 --- a/go.sum +++ b/go.sum @@ -776,6 +776,7 @@ github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=