Skip to main content

LensStudio:Subprocess.ProcessState

Enum

The process state of a "LensStudio:Subprocess".spawn or "LensStudio:Subprocess".spawnSync.

Index

Enumeration Members

Example

const Sub = await import('LensStudio:Subprocess');

// ProcessState describes the current state of a spawned subprocess:
// Idle (0) — not running
// Starting (1) — initializing
// Running (2) — actively running
const proc = Sub.spawn('echo', ['hello'], {} as any);

// Monitor state transitions via onStateChange signal
this.connections.push(
proc.onStateChange.connect((state: number) => {
if (state === Sub.ProcessState.Idle) {
console.log('Process is idle');
} else if (state === Sub.ProcessState.Starting) {
console.log('Process is starting');
} else if (state === Sub.ProcessState.Running) {
console.log('Process is running');
}
})
);

this.connections.push(
proc.onExit.connect((exitCode: number, exitStatus: number) => {
console.log('Process exited with code:', exitCode, 'status:', exitStatus);
})
);

Enumeration Members

Idle

Idle: number

Process is not running.


Running

Running: number

Process is actively running.


Starting

Starting: number

Process is initializing and starting up.