Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ dist-%: ## Create package for specific platform and architecture (e.g., dist-dar
rm -rf $$PLATFORM_DIR; \
mkdir -p $$PLATFORM_DIR/bin; \
mkdir -p $$PLATFORM_DIR/packages/cli; \
mkdir -p $$PLATFORM_DIR/packages/cli/cmd/script; \
cp packages/cli/gbox-$$PLATFORM_ARCH $$PLATFORM_DIR/packages/cli/gbox; \
cp -r packages/cli/cmd/script/. $$PLATFORM_DIR/packages/cli/cmd/script/; \
cp .env $$PLATFORM_DIR/ 2>/dev/null || true; \
cp LICENSE README.md $$PLATFORM_DIR/; \
if [ -f "packages/cli/gbox-$$PLATFORM_ARCH" ]; then \
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/internal/adb_expose/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

sdk "github.com/babelcloud/gbox-sdk-go"
gboxsdk "github.com/babelcloud/gbox/packages/cli/internal/client"
"github.com/babelcloud/gbox/packages/cli/internal/proc_group"
"github.com/babelcloud/gbox/packages/cli/internal/util"
)

Expand Down Expand Up @@ -508,10 +509,8 @@ func startServerInBackground() error {
// Create command to start server in background with reply fd
cmd := exec.Command(execPath, "server", "start", "--reply-fd", "3")

// Set up process attributes for daemon mode
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true, // Create new process group
}
// Set up process attributes for daemon mode (platform-specific)
procgroup.SetProcGrp(cmd)

// Pass the write end of the pipe as file descriptor 3
cmd.ExtraFiles = []*os.File{writer}
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/internal/server/auto_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"strconv"
"syscall"
"time"

"github.com/babelcloud/gbox/packages/cli/internal/proc_group"
)

// AutoStartManager manages automatic server startup
Expand Down Expand Up @@ -64,10 +66,8 @@ func (m *AutoStartManager) startServerInBackground() error {
// Create command to start server in background
cmd := exec.Command(execPath, "server", "start", "--daemon")

// Set up process attributes for daemon mode
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true, // Create new process group
}
// Set up process attributes for daemon mode (platform-specific)
procgroup.SetProcGrp(cmd)

// Redirect output to log file
logFile, err := os.OpenFile(m.logFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
Expand Down