Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
main: Introduce defaultErrorFile
Browse files Browse the repository at this point in the history
Add a "defaultErrorFile" variable for parity with "defaultOutputFile"
and to allow testing the fatal() function (which now uses
defaultErrorFile).

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Sep 7, 2017
1 parent d08eb02 commit b278bfa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ var vci vc.VC = virtcontainersImpl
// information to.
var defaultOutputFile = os.Stdout

// defaultErrorFile is the default output file to write error
// messages to.
var defaultErrorFile = os.Stderr

func beforeSubcommands(context *cli.Context) error {
if userWantsUsage(context) || (context.NArg() == 1 && (context.Args()[0] == "cc-check")) {
// No setup required if the user just
Expand Down Expand Up @@ -216,7 +220,7 @@ func userWantsUsage(context *cli.Context) bool {
// fatal prints the error's details exits the program.
func fatal(err error) {
ccLog.Error(err)
fmt.Fprintln(os.Stderr, err)
fmt.Fprintln(defaultErrorFile, err)
exit(1)
}

Expand Down

0 comments on commit b278bfa

Please sign in to comment.