@@ -159,7 +159,7 @@ func StartProcessManager(
159
159
if processComposeConfig .Background {
160
160
flags = append (flags , "-t=false" )
161
161
cmd := exec .Command (processComposeConfig .BinPath , flags ... )
162
- return runProcessManagerInBackground (cmd , config , port , projectDir )
162
+ return runProcessManagerInBackground (cmd , config , port , projectDir , w )
163
163
}
164
164
165
165
cmd := exec .Command (processComposeConfig .BinPath , flags ... )
@@ -206,7 +206,7 @@ func runProcessManagerInForeground(cmd *exec.Cmd, config *globalProcessComposeCo
206
206
return writeGlobalProcessComposeJSON (config , configFile )
207
207
}
208
208
209
- func runProcessManagerInBackground (cmd * exec.Cmd , config * globalProcessComposeConfig , port int , projectDir string ) error {
209
+ func runProcessManagerInBackground (cmd * exec.Cmd , config * globalProcessComposeConfig , port int , projectDir string , w io. Writer ) error {
210
210
logdir := filepath .Join (projectDir , processComposeLogfile )
211
211
logfile , err := os .OpenFile (logdir , os .O_CREATE | os .O_WRONLY | os .O_APPEND | os .O_TRUNC , 0o664 )
212
212
if err != nil {
@@ -216,6 +216,8 @@ func runProcessManagerInBackground(cmd *exec.Cmd, config *globalProcessComposeCo
216
216
cmd .Stdout = logfile
217
217
cmd .Stderr = logfile
218
218
219
+ // These attributes set the process group ID to the process ID of process-compose
220
+ // Starting in it's own process group means it won't be terminated if the shell crashes
219
221
cmd .SysProcAttr = & syscall.SysProcAttr {
220
222
Setpgid : true ,
221
223
Pgid : 0 ,
@@ -225,6 +227,9 @@ func runProcessManagerInBackground(cmd *exec.Cmd, config *globalProcessComposeCo
225
227
return fmt .Errorf ("failed to start process-compose: %w" , err )
226
228
}
227
229
230
+ fmt .Fprintf (w , "Process-compose is now running on port %d\n " ,port )
231
+ fmt .Fprintf (w , "To stop your services, run `devbox services stop`\n " )
232
+
228
233
projectConfig := instance {
229
234
Pid : cmd .Process .Pid ,
230
235
Port : port ,
@@ -309,7 +314,7 @@ func AttachToProcessManager(ctx context.Context, w io.Writer, projectDir string,
309
314
310
315
project , ok := config .Instances [projectDir ]
311
316
if ! ok {
312
- return fmt .Errorf ("Process -compose is not running for this project. To start it, run `devbox services up`" )
317
+ return fmt .Errorf ("process -compose is not running for this project. To start it, run `devbox services up`" )
313
318
}
314
319
315
320
flags := []string {"attach" , "-p" , strconv .Itoa (project .Port )}
0 commit comments