commands/run.go: teach Run() to return an exit code

This commit is contained in:
Taylor Blau 2018-04-12 12:16:07 -07:00
parent 3ce49b133a
commit 3379c0c161
2 changed files with 7 additions and 2 deletions

@ -49,7 +49,9 @@ func RegisterCommand(name string, runFn func(cmd *cobra.Command, args []string),
// Run initializes the 'git-lfs' command and runs it with the given stdin and
// command line args.
func Run() {
//
// It returns an exit code.
func Run() int {
log.SetOutput(ErrorWriter)
root := NewCommand("git-lfs", gitlfsCommand)
@ -70,6 +72,8 @@ func Run() {
root.Execute()
closeAPIClient()
return 0
}
func gitlfsCommand(cmd *cobra.Command, args []string) {

@ -32,6 +32,7 @@ func main() {
}
}()
commands.Run()
code := commands.Run()
once.Do(commands.Cleanup)
os.Exit(code)
}