MCPcopy Index your code
hub / github.com/jetify-com/devbox / runProcessManagerInForeground

Function runProcessManagerInForeground

internal/services/manager.go:174–214  ·  view source on GitHub ↗
(cmd *exec.Cmd, config *globalProcessComposeConfig, port int, projectDir string, w io.Writer)

Source from the content-addressed store, hash-verified

172}
173
174func runProcessManagerInForeground(cmd *exec.Cmd, config *globalProcessComposeConfig, port int, projectDir string, w io.Writer) error {
175 cmd.Stdout = os.Stdout
176 cmd.Stderr = os.Stderr
177 if err := cmd.Start(); err != nil {
178 return fmt.Errorf("failed to start process-compose: %w", err)
179 }
180
181 projectConfig := instance{
182 Pid: cmd.Process.Pid,
183 Port: port,
184 }
185
186 config.Instances[projectDir] = projectConfig
187
188 err := writeGlobalProcessComposeJSON(config, config.File)
189 if err != nil {
190 return err
191 }
192
193 // We're waiting now, so we can unlock the file
194 config.File.Close()
195
196 err = cmd.Wait()
197 if err != nil {
198 if err.Error() == "exit status 1" {
199 fmt.Fprintf(w, "Process-compose was terminated remotely, %s\n", err.Error())
200 return nil
201 }
202 return err
203 }
204
205 configFile, err := openGlobalConfigFile()
206 if err != nil {
207 return err
208 }
209
210 config = readGlobalProcessComposeJSON(configFile)
211
212 delete(config.Instances, projectDir)
213 return writeGlobalProcessComposeJSON(config, configFile)
214}
215
216func runProcessManagerInBackground(cmd *exec.Cmd, config *globalProcessComposeConfig, port int, projectDir string, w io.Writer) error {
217 logdir := filepath.Join(projectDir, processComposeLogfile)

Callers 1

StartProcessManagerFunction · 0.85

Calls 4

openGlobalConfigFileFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected