| 154 | } |
| 155 | |
| 156 | func panicHandler() { |
| 157 | if r := recover(); r != nil { |
| 158 | if os.Getenv("STEPDEBUG") == "1" { |
| 159 | fmt.Fprintf(os.Stderr, "%s\n", step.Version()) |
| 160 | fmt.Fprintf(os.Stderr, "Release Date: %s\n\n", step.ReleaseDate()) |
| 161 | panic(r) |
| 162 | } |
| 163 | |
| 164 | fmt.Fprintln(os.Stderr, "Something unexpected happened.") |
| 165 | fmt.Fprintln(os.Stderr, "If you want to help us debug the problem, please run:") |
| 166 | fmt.Fprintf(os.Stderr, "STEPDEBUG=1 %q\n", strings.Join(os.Args, " ")) // #nosec G705 -- terminal output |
| 167 | fmt.Fprintln(os.Stderr, "and send the output to info@smallstep.com") |
| 168 | os.Exit(2) |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | func flagValue(f cli.Flag) reflect.Value { |
| 173 | fv := reflect.ValueOf(f) |