Fatalf formats a message to standard error and exits the program. The message is also printed to standard output if standard error is redirected to a different file.
(format string, args ...interface{})
| 66 | // The message is also printed to standard output if standard error |
| 67 | // is redirected to a different file. |
| 68 | func Fatalf(format string, args ...interface{}) { |
| 69 | w := io.MultiWriter(os.Stdout, os.Stderr) |
| 70 | if runtime.GOOS == "windows" || runtime.GOOS == "openbsd" { |
| 71 | // The SameFile check below doesn't work on Windows neither OpenBSD. |
| 72 | // stdout is unlikely to get redirected though, so just print there. |
| 73 | w = os.Stdout |
| 74 | } else { |
| 75 | outf, _ := os.Stdout.Stat() |
| 76 | errf, _ := os.Stderr.Stat() |
| 77 | if outf != nil && errf != nil && os.SameFile(outf, errf) { |
| 78 | w = os.Stderr |
| 79 | } |
| 80 | } |
| 81 | fmt.Fprintf(w, "Fatal: "+format+"\n", args...) |
| 82 | os.Exit(1) |
| 83 | } |
| 84 | |
| 85 | func StartNode(ctx *cli.Context, stack *node.Node, isConsole bool) { |
| 86 | if err := stack.Start(); err != nil { |
searching dependent graphs…