Skip to content

parseProcStatus

parseProcStatus(raw): ProcStatus

Defined in: packages/core/src/kernel/lib/proc-parsers.ts:68

Parse the contents of /proc/<pid>/status into a ProcStatus.

string

Raw file contents, e.g. the result of reading /proc/<pid>/status to string.

ProcStatus

A ProcStatus with every known field populated (empty string for missing lines).

procFS speaks newline-delimited text. Each line is key: value; unknown keys are ignored, and lines without a colon are skipped. Used by ps and other readers of procFS status files — they share this parser so the wire format stays consistent across consumers.

import { parseProcStatus } from '@fishnet/core'
const status = parseProcStatus([
'pid: 1',
'ppid: 0',
'state: running',
'uid: 0',
'cwd: /',
].join('\n'))
// status.state === 'running'