Skip to content

Info

Information about a process at a moment in time.

Every field other than pid and name may be nil for reasons beyond those documented on it: the process had already exited and the value was no longer available, it was a kernel process and never had one, or it could not be read for want of permission.

Example

for info = proc.enumerate()
  if (info.name == "sshd")
    echo "$(info.pid) $(info.exe)"

Fields

cmdline @ (Tuple[...Str] | nil)

The argument vector, as Str elements.

Restricted to processes owned by the same user on macOS. Windows represents arguments as a single string rather than an array, so what is reported here is split according to typical C runtime conventions; cmdline_win is the raw original.

cmdline_win @ (Str | nil)

The command line as a single string.

Windows only: reading it on a record captured from another platform raises FieldError.

let p = proc.open $pid
echo $p.info().cmdline_win
cwd @ (fs.Path | nil)

The working directory.

Reading another user's working directory needs elevated rights. On Windows this is maintained by the C runtime rather than reported authoritatively by the kernel, so an application may set it to anything.

exe @ (fs.Path | nil)

The executable path.

Reading another user's executable path needs elevated rights on every platform.

name @ Str

The kernel's short name for the process.

On Unix this reflects whatever the process last set, and is typically truncated.

parent_pid @ (Int | nil)

The parent process ID.

Windows does not reparent orphaned processes, so this may be invalid or reassigned.

pid @ Int

The process ID.

status @ (Status | nil)

How the process ended, or nil if it was still running.

token_info @ (security.windows.TokenInfo | nil)

The process access token.

Windows only: reading it on a record captured from another platform raises FieldError.

unix_id @ (security.unix.Identity | nil)

The process credentials.

Unix only: reading it on a record captured from another platform raises FieldError. On macOS, groups is capped at 16 entries.