func main() { defer rescue() flag.Usage = usage flag.Parse() if *help { usage() os.Exit(0) } if *log != "" { err := logutil.SetOutputFile(*log) if err != nil { fmt.Println(err) } } go handleQuit() go logSignals() args := flag.Args() switch len(args) { case 0: interact() case 1: script(args[0]) default: usage() os.Exit(2) } }
func _log(ec *EvalCtx, fname string) { maybeThrow(logutil.SetOutputFile(fname)) }