(h *Handler)
| 33 | } |
| 34 | |
| 35 | func newCommand(h *Handler) (*command, error) { |
| 36 | pf := parseProcfile(h.Procfile, h.PortBase, h.PortStep, h.Formation, h.FormationPortStep, h.StopSignals) |
| 37 | |
| 38 | c := command{ |
| 39 | timeout: h.Timeout, |
| 40 | doneTrig: make(chan bool, len(pf)), |
| 41 | stopTrig: make(chan os.Signal, 1), |
| 42 | infoTrig: make(chan os.Signal, 1), |
| 43 | processes: make([]*process, 0, len(pf)), |
| 44 | daemonize: h.Daemonize, |
| 45 | } |
| 46 | |
| 47 | root, err := h.AbsRoot() |
| 48 | if err != nil { |
| 49 | return nil, err |
| 50 | } |
| 51 | |
| 52 | if len(h.Title) > 0 { |
| 53 | c.title = h.Title |
| 54 | } else { |
| 55 | c.title = filepath.Base(root) |
| 56 | } |
| 57 | |
| 58 | session := utils.EscapeTitle(c.title) |
| 59 | nanoid, err := gonanoid.Nanoid() |
| 60 | if err != nil { |
| 61 | return nil, err |
| 62 | } |
| 63 | |
| 64 | instanceID := fmt.Sprintf("overmind-%s-%s", session, nanoid) |
| 65 | |
| 66 | c.output = newMultiOutput(pf.MaxNameLength(), h.ShowTimestamps) |
| 67 | c.tmux = newTmuxClient(session, instanceID, root, h.TmuxConfigPath, c.output.Offset()) |
| 68 | |
| 69 | procNames := utils.SplitAndTrim(h.ProcNames) |
| 70 | ignoredProcNames := utils.SplitAndTrim(h.IgnoredProcNames) |
| 71 | |
| 72 | colors := defaultColors |
| 73 | if len(h.Colors) > 0 { |
| 74 | colors = h.Colors |
| 75 | } |
| 76 | |
| 77 | canDie := utils.SplitAndTrim(h.CanDie) |
| 78 | autoRestart := utils.SplitAndTrim(h.AutoRestart) |
| 79 | |
| 80 | c.scriptDir = filepath.Join(os.TempDir(), instanceID) |
| 81 | os.MkdirAll(c.scriptDir, 0700) |
| 82 | |
| 83 | for i, e := range pf { |
| 84 | shouldRun := len(procNames) == 0 || utils.StringsContain(procNames, e.OrigName) |
| 85 | isIgnored := len(ignoredProcNames) != 0 && utils.StringsContain(ignoredProcNames, e.OrigName) |
| 86 | |
| 87 | if shouldRun && !isIgnored { |
| 88 | scriptFilePath := c.createScriptFile(&e, h.Shell, !h.NoPort) |
| 89 | |
| 90 | c.processes = append(c.processes, newProcess( |
| 91 | c.tmux, |
| 92 | e.Name, |
no test coverage detected
searching dependent graphs…