github.com/ndau/noms@v1.0.5/go/util/exit/exit.go (about)

     1  // Copyright 2016 Attic Labs, Inc. All rights reserved.
     2  // Licensed under the Apache License, version 2.0:
     3  // http://www.apache.org/licenses/LICENSE-2.0
     4  
     5  // Package exit provides a mockable implementation of os.Exit.
     6  // That's all!
     7  package exit
     8  
     9  import (
    10  	"os"
    11  )
    12  
    13  var def = func(code int) {
    14  	os.Exit(code)
    15  }
    16  
    17  var Exit = def
    18  
    19  // Reset sets the implementation of Exit() to the default.
    20  func Reset() {
    21  	Exit = def
    22  }
    23  
    24  // Fail exits with a failure status.
    25  func Fail() {
    26  	Exit(1)
    27  }
    28  
    29  // Success exits with a success status.
    30  func Success() {
    31  	Exit(0)
    32  }