()
| 110 | } |
| 111 | |
| 112 | func (c *command) Run() (int, error) { |
| 113 | defer os.RemoveAll(c.scriptDir) |
| 114 | defer c.output.Stop() |
| 115 | |
| 116 | fmt.Printf("\033]0;%s | overmind\007", c.title) |
| 117 | |
| 118 | if !c.checkTmux() { |
| 119 | return 1, errors.New("Can't find tmux. Did you forget to install it?") |
| 120 | } |
| 121 | |
| 122 | c.output.WriteBoldLinef(nil, "Tmux socket name: %v", c.tmux.Socket) |
| 123 | c.output.WriteBoldLinef(nil, "Tmux session ID: %v", c.tmux.Session) |
| 124 | c.output.WriteBoldLinef(nil, "Listening at %v", c.cmdCenter.SocketPath) |
| 125 | |
| 126 | c.startCommandCenter() |
| 127 | defer c.stopCommandCenter() |
| 128 | |
| 129 | if c.daemonize { |
| 130 | if !daemon.WasReborn() { |
| 131 | c.stopCommandCenter() |
| 132 | } |
| 133 | |
| 134 | ctx := new(daemon.Context) |
| 135 | child, err := ctx.Reborn() |
| 136 | |
| 137 | if child != nil { |
| 138 | c.output.WriteBoldLinef(nil, "Daemonized. Use `overmind echo` to view logs and `overmind quit` to gracefully quit daemonized instance") |
| 139 | return 0, err |
| 140 | } |
| 141 | |
| 142 | defer ctx.Release() |
| 143 | } |
| 144 | |
| 145 | c.runProcesses() |
| 146 | |
| 147 | go c.waitForExit() |
| 148 | |
| 149 | go c.handleInfo() |
| 150 | |
| 151 | c.doneWg.Wait() |
| 152 | |
| 153 | exitCode := c.tmux.ExitCode() |
| 154 | |
| 155 | time.Sleep(time.Second) |
| 156 | |
| 157 | c.tmux.Shutdown() |
| 158 | |
| 159 | return exitCode, nil |
| 160 | } |
| 161 | |
| 162 | func (c *command) Quit() { |
| 163 | c.stopTrig <- syscall.SIGINT |
nothing calls this directly
no test coverage detected