From 8e746386fe4777c9d932e870ea156bf10d446b3b Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 29 May 2018 06:30:16 -0400 Subject: [PATCH] Crash nicely on no argument. --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index ce96c1e7fb..7da8cfd077 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ package deno import ( "flag" + "fmt" "github.com/ry/v8worker2" "os" "runtime/pprof" @@ -69,6 +70,12 @@ var main_map string func Init() { workerArgs = FlagsParse() + if len(workerArgs) == 0 { + fmt.Fprintf(os.Stderr, "Usage: %s file.ts\n", os.Args[0]) + flag.PrintDefaults() + os.Exit(1) + } + // Maybe start Golang CPU profiler. // Use --prof for profiling JS. if *flagGoProf != "" {