We use cookies to improve your experience.

Cookie Policy
Logo of Lexmount
DocsTemplatesBlogHelp Center
GitHub
Logo of LexmountLexmount Browser

Get started

Lexmount Documentation
Console guide

Browser

Web Fetch

OverviewQuick Start
Common Errors

Web Search

OverviewQuick StartSearch API

Runtime

OverviewQuickstart
Overviewfetchlexmount:env
Overviewhost.fshost.fetchhost.processhost.tcphost.http
lexmount:browser
Examples

Help and billing

Capability FAQ
ChangelogContact support
API Referencelexmount:remote

host.process

Query client processes, run commands, and control streaming child processes.

The process interface queries processes, runs shell commands, and controls child processes with streaming input and output on the selected client.

Here, host is a selected RemoteHost; see host discovery to obtain one. The module overview covers permissions and shared errors.

Queries require process.enabled. exec() and spawn() additionally require process.allow_exec.

host.process.list()

Function: obtains a PID-sorted process snapshot.

Parameters: none.

Return value: AsyncIterableIterator<ProcessInfo>. Sampling occurs on the first next(); exhaustion, return(), or break releases the snapshot.

host.process.get(pid)

Function: queries a specific process.

Parameters: required pid: number, the process ID.

Return value: Promise<ProcessInfo | null>. An absent or no-longer-visible process returns null.

ProcessInfo

FieldTypeDescription
pidnumberProcess ID
parentPidnumber / nullParent process ID
name, exe, statusstring / nullName, executable path, and status
commandLinereadonly string[] / nullCommand-line arguments
startTimeDate / nullProcess start time on the client
cpuUsagenumber / nullCPU percentage; one fully utilized logical core is 100
memoryBytesnumber / nullResident memory in bytes

Fields are read-only; unavailable information is null.

host.process.exec(command)

Function: executes a shell command, automatically sends stdin EOF, and collects complete stdout and stderr.

Parameters: required command: string. Commands inherit the client's working directory, environment, and system user permissions. Linux / macOS use /bin/sh -c; Windows uses cmd.exe /d /s /c.

Return value: Promise<ProcessResult>, containing stdout: Uint8Array, stderr: Uint8Array, exitCode: number | null, and signal: number | null. Nonzero exit codes are returned without automatically throwing. signal is the Unix signal number, or null for normal exits and on Windows.

host.process.spawn(command)

Function: starts a shell child process with streaming input and output. Working directory, environment, and shell rules match exec().

Parameters: required command: string.

Return value: Promise<ChildProcess>, with these read-only properties and a kill() method.

PropertyTypeDescription
pidnumberChild process ID
commandLinestringSubmitted command
stdout, stderrReadableStream<Uint8Array>Raw byte output with backpressure; canceling one closes only that output pipe
stdinWritableStream<Uint8Array>Closing its writer sends EOF; abort closes the input pipe
statusPromise<ProcessStatus>{ exitCode: number | null, signal: number | null }, with the same meaning as exec

Consume stdout and stderr concurrently and close the stdin writer when done. Waiting only for status can block on full output pipes. Drain remaining output even after status resolves. The process cursor is released after status, both outputs, and submitted input operations complete; the last completing operation can report cleanup failure.

child.kill()

Function: forcefully stops the child process group or job and waits for the child to be reaped. Descendants can still be stopped after status resolves until cursor release.

Parameters: none.

Return value: Promise<void>.

See remote.d.ts for type declarations.

host.fetch

Make HTTP requests from a client to local, private, or public services.

host.tcp

Connect and listen for TCP connections on a client.

Table of Contents

host.process.list()
host.process.get(pid)
ProcessInfo
host.process.exec(command)
host.process.spawn(command)
child.kill()

Still need help?Ask on Discord