Skip to content

Popen

Defined in: packages/pythonlib/src/subprocess.ts:281

A subprocess.Popen-like class for more control over process execution.

Constructors

Constructor

new Popen(args: string | string[], options?: SubprocessOptions): Popen

Defined in: packages/pythonlib/src/subprocess.ts:288

Parameters

ParameterType
argsstring | string[]
options?SubprocessOptions

Returns

Popen

Properties

args

readonly args: string[]

Defined in: packages/pythonlib/src/subprocess.ts:282

Accessors

pid

Get Signature

get pid(): number | undefined

Defined in: packages/pythonlib/src/subprocess.ts:415

The process ID.

Returns

number | undefined


returncode

Get Signature

get returncode(): number | null

Defined in: packages/pythonlib/src/subprocess.ts:422

The exit code (or null if still running).

Returns

number | null


stderr

Get Signature

get stderr(): string | null

Defined in: packages/pythonlib/src/subprocess.ts:436

The captured stderr.

Returns

string | null


stdout

Get Signature

get stdout(): string | null

Defined in: packages/pythonlib/src/subprocess.ts:429

The captured stdout.

Returns

string | null

Methods

communicate()

communicate(input?: string | Uint8Array<ArrayBufferLike>): Promise<[string | null, string | null]>

Defined in: packages/pythonlib/src/subprocess.ts:378

Communicate with the process and return stdout/stderr.

Parameters

ParameterType
input?string | Uint8Array<ArrayBufferLike>

Returns

Promise<[string | null, string | null]>


kill()

kill(): boolean

Defined in: packages/pythonlib/src/subprocess.ts:406

Kill the process.

Returns

boolean


poll()

poll(): number | null

Defined in: packages/pythonlib/src/subprocess.ts:371

Get the exit code (or null if still running).

Returns

number | null


send_signal()

send_signal(signal: number | Signals): boolean

Defined in: packages/pythonlib/src/subprocess.ts:392

Send a signal to the process.

Parameters

ParameterType
signalnumber | Signals

Returns

boolean


terminate()

terminate(): boolean

Defined in: packages/pythonlib/src/subprocess.ts:399

Terminate the process.

Returns

boolean


wait()

wait(): Promise<number>

Defined in: packages/pythonlib/src/subprocess.ts:356

Wait for the process to complete.

Returns

Promise<number>