| 114 | } |
| 115 | |
| 116 | func Main() { |
| 117 | timer := debug.Timer(strings.Join(os.Args, " ")) |
| 118 | setSystemBinaryPaths() |
| 119 | ctx := context.Background() |
| 120 | |
| 121 | if len(os.Args) > 1 && os.Args[1] == "upload-telemetry" { |
| 122 | // This subcommand is hidden and only run by devbox itself as a |
| 123 | // child process. We need to really make sure that we always |
| 124 | // exit and don't leave orphaned processes laying around. |
| 125 | time.AfterFunc(5*time.Second, func() { |
| 126 | os.Exit(0) |
| 127 | }) |
| 128 | telemetry.Upload() |
| 129 | return |
| 130 | } |
| 131 | |
| 132 | code := Execute(ctx, os.Args[1:]) |
| 133 | // Run out here instead of as a middleware so we can capture any time we spend |
| 134 | // in middlewares as well. |
| 135 | timer.End() |
| 136 | os.Exit(code) |
| 137 | } |
| 138 | |
| 139 | func listAllCommands(cmd *cobra.Command, indent string) { |
| 140 | // Print this command's name and description in table format with indentation |