proc

package
v0.1.433 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package proc makes the commands magpie runs: agents' CLIs, the probes that ask them what they have, the system's own tools. Every one is made here rather than with os/exec, so that on Windows none of them opens a window.

The desktop app on Windows is linked as a GUI program and has no console. A console program it starts (devin, claude, codex, cursor-agent, grok, the probes behind them) is given a new console by Windows, and with it a window, one for every run; so a child of a magpie with no console is started with CREATE_NO_WINDOW, which gives it a console without one. A magpie run in a terminal, or the desktop app started from one with a command, lets its children share that console as before, so Ctrl+C there reaches them too. Nothing magpie starts reads or writes the terminal itself: its output is piped back, which a hidden console doesn't change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(name string, args ...string) *exec.Cmd

Command is exec.Command, with no window of its own on Windows.

func CommandContext

func CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd

CommandContext is exec.CommandContext, with no window of its own on Windows.

func UserPath added in v0.1.67

func UserPath()

UserPath gives the desktop app the PATH a terminal of the user's has. One opened from the Finder, the Dock or a login item gets launchd's /usr/bin:/bin:/usr/sbin:/sbin and nothing a shell profile adds, so a claude or codex installed with a custom npm prefix (~/.npm-global/bin), nvm, bun, volta or asdf wasn't found: the agent wasn't seen and its subscription couldn't be used. The folders those tools use are added at once, when they exist; the login shell's own PATH is asked for in the background and added after, since a slow profile mustn't hold the window up.

Types

type Process added in v0.1.368

type Process struct {
	PID  int
	Args string
}

A Process is one running on this computer, as the system lists it: its id and its command line, arguments joined by spaces.

func List added in v0.1.368

func List(ctx context.Context, prefix string) ([]Process, error)

List lists the running processes (Windows: only those named prefix*, since asking for all is slow there; elsewhere prefix is ignored). An error says the system couldn't be asked, not that nothing runs.

type Tree added in v0.1.183

type Tree struct {
	// contains filtered or unexported fields
}

A Tree is a started command and the processes it starts in turn: an agent's CLI with the MCP servers, shells and helpers it runs. Killing the CLI alone leaves those running, so they are ended with it.

func StartTree added in v0.1.183

func StartTree(cmd *exec.Cmd) (*Tree, error)

StartTree starts cmd in a group of its own: a session on Unix, a job on Windows. It has no terminal then, and a Ctrl+C there doesn't reach it.

func (*Tree) Kill added in v0.1.183

func (t *Tree) Kill()

Kill ends the command and every process of its tree.

func (*Tree) Wait added in v0.1.183

func (t *Tree) Wait() error

Wait waits for the command, then ends what it left running.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL