RunWithoutExit is like Run but returns exit code instead of calling os.Exit To be used in maddy.cover.
()
| 85 | // RunWithoutExit is like Run but returns exit code instead of calling os.Exit |
| 86 | // To be used in maddy.cover. |
| 87 | func RunWithoutExit() int { |
| 88 | code := 0 |
| 89 | |
| 90 | cli.OsExiter = func(c int) { code = c } |
| 91 | defer func() { |
| 92 | cli.OsExiter = os.Exit |
| 93 | }() |
| 94 | |
| 95 | Run() |
| 96 | |
| 97 | return code |
| 98 | } |
| 99 | |
| 100 | func Run() { |
| 101 | mapStdlibFlags(app) |