Files
archie/.okf/codebase/internal/agentexec/subprocess_process_unix.md
T
sam 7c34bdae5a okf: scaffold knowledge bundle and MCP server config
Adds a harvested .okf/ knowledge bundle (codebase concepts + starter
architecture/services/rules scaffolding) and .mcp.json pointing at the
shared okf MCP service (http://localhost:8765/archie-core/), which
serves multiple projects' bundles from a single process.
2026-07-22 04:36:50 +10:00

1.1 KiB

description, resource, tags, timestamp, title, type
description resource tags timestamp title type
Source module internal/agentexec/subprocess_process_unix.go (27 lines). internal/agentexec/subprocess_process_unix.go
go
source
2026-07-21T18:36:22Z subprocess_process_unix.go Module

Module subprocess_process_unix.go

Path: internal/agentexec/subprocess_process_unix.go
Lines: 27

Snippet Preview

//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris

package agentexec

import (
	"errors"
	"os"
	"os/exec"
	"syscall"
)

// configureProcessCancellation puts the worker and every command it starts in
// a dedicated process group. CommandContext cancellation then kills the whole
// group so toolchain grandchildren cannot continue mutating the worktree.
func configureProcessCancellation(cmd *exec.Cmd) {
	cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
	cmd.Cancel = func() error {
		if cmd.Process == nil {
			return os.ErrProcessDone
		}
		err := syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
		if errors.Is(err, syscall.ESRCH) {
			return os.ErrProcessDone
		}
		return err
	}
}