github.com/getgauge/gauge@v1.6.9/gauge.go (about)

     1  /*----------------------------------------------------------------
     2   *  Copyright (c) ThoughtWorks, Inc.
     3   *  Licensed under the Apache License, Version 2.0
     4   *  See LICENSE in the project root for license information.
     5   *----------------------------------------------------------------*/
     6  
     7  package main
     8  
     9  import (
    10  	"os"
    11  	"runtime/debug"
    12  
    13  	"github.com/getgauge/gauge/cmd"
    14  	"github.com/getgauge/gauge/logger"
    15  )
    16  
    17  func main() {
    18  	defer recoverPanic()
    19  	if err := cmd.Parse(); err != nil {
    20  		logger.Info(true, err.Error())
    21  		os.Exit(1)
    22  	}
    23  }
    24  
    25  func recoverPanic() {
    26  	if r := recover(); r != nil {
    27  		logger.Fatalf(true, "Error: %v\n%s", r, string(debug.Stack()))
    28  	}
    29  }