fgproc

package
v0.135.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fgproc names the program a shell is running in its foreground: what a terminal app asks before it closes a tab ("Shell 1 is running claude").

On macOS and Linux the answer is the terminal's foreground process group, read from the shell process itself (its tpgid): when that group is not the shell's own, a job is in front of the prompt, and the group's leader names it. Nothing here opens the terminal or talks to the pty-host; the kernel keeps the tpgid on every process of the session. On Windows it is a scan for the shell's child processes, best effort: it may name nothing, and it never fails.

The name is the program's argv[0] as typed, not the kernel's short name: Claude Code's native binary is a file named after its version, so the kernel calls it "2.1.289" while argv[0] says "claude".

Callers pass only the pid of a shell Caprock started (rule 7); this package reads, it never signals.

Index

Constants

View Source
const Unnamed = "program"

Unnamed is what Foreground answers for a job it can see but not name, such as a pipeline whose first process has already exited.

Variables

This section is empty.

Functions

func Foreground

func Foreground(shellPID int) string

Foreground is the name of the program in front of the shell with this pid, or "" when the shell is at its prompt, has exited, or the platform cannot tell.

Types

This section is empty.

Jump to

Keyboard shortcuts

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