Skip to content

Commit

Permalink
help windows users by detecting if the program was invoked from explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
inconshreveable committed Apr 25, 2014
1 parent c260a1a commit f2686d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ngrok/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@ package client

import (
"fmt"
"github.com/inconshreveable/mousetrap"
"math/rand"
"ngrok/log"
"ngrok/util"
"os"
"runtime"
"time"
)

func init() {
if runtime.GOOS == "windows" {
if ok, err := mousetrap.InvokedFromCommandLine(); err == nil && !ok {
fmt.Println("Don't double-click ngrok!")
fmt.Println("You need to open cmd.exe and run it from the command line!")
time.Sleep(5 * time.Second)
os.Exit(1)
}
}
}

func Main() {
// parse options
opts, err := ParseArgs()
Expand Down

0 comments on commit f2686d7

Please sign in to comment.