MCPcopy Index your code
hub / github.com/DarthSim/overmind / createScriptFile

Method createScriptFile

start/command.go:166–182  ·  view source on GitHub ↗
(e *procfileEntry, shell string, setPort bool)

Source from the content-addressed store, hash-verified

164}
165
166func (c *command) createScriptFile(e *procfileEntry, shell string, setPort bool) string {
167 scriptFile, err := os.Create(filepath.Join(c.scriptDir, e.Name))
168 utils.FatalOnErr(err)
169
170 fmt.Fprintf(scriptFile, "#!/usr/bin/env %s\n", shell)
171 if setPort {
172 fmt.Fprintf(scriptFile, "export PORT=%d\n", e.Port)
173 }
174 fmt.Fprintf(scriptFile, "export PS=%s\n", e.Name)
175 fmt.Fprintln(scriptFile, e.Command)
176
177 utils.FatalOnErr(scriptFile.Chmod(0744))
178
179 utils.FatalOnErr(scriptFile.Close())
180
181 return scriptFile.Name()
182}
183
184func (c *command) checkTmux() bool {
185 return utils.RunCmd("tmux", "-V") == nil

Callers 1

newCommandFunction · 0.95

Calls 1

FatalOnErrFunction · 0.92

Tested by

no test coverage detected