process

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 4 Imported by: 0

README

native/process

English | 简体中文

ForegroundPID(*os.File) returns a terminal's foreground process group ID; Directory(pid) reads a process's working directory. Both return errors, leave file ownership with the caller, and do not invoke a shell. macOS uses libproc and tcgetpgrp; Linux uses /proc and terminal ioctl. Other platforms return native.ErrUnsupported. Invalid arguments return native.ErrInvalidArgument; disappearing processes and non-terminal descriptors return native.ErrFailed.

Dependencies: native, native/internal/sys. No UI or Gio dependencies. Platform bindings remain inside native/internal/sys.

Documentation

Overview

Package process provides terminal foreground process and working-directory queries without a UI dependency. macOS and Linux are supported; other builds return native.ErrUnsupported. Query results may change as processes exit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Directory

func Directory(pid int) (string, error)

Directory reads the process's current working directory, without invoking a shell.

func ForegroundPID

func ForegroundPID(terminal *os.File) (int, error)

ForegroundPID returns a terminal's foreground process group ID. On Unix this is the group leader PID, not necessarily the deepest running child process. The caller retains ownership of terminal and must keep it open during the call.

Types

This section is empty.

Jump to

Keyboard shortcuts

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