runstorm - v0.6.2
    Preparing search index...

    Class ShellWorker

    An individual shell command spawned in a separate worker thread. Use static methods to create an instance.

    Hierarchy

    Index

    Constructors

    Properties

    errors: Error[] = []

    All errors from the worker thread are accumulated here.

    exitCode: undefined | number

    This will only be populated once the worker thread has exited or crashed.

    hasStarted: boolean = false

    Indicates that the worker thread has started.

    isDestroyed: boolean = ...

    true if this instance has been destroyed.

    options: Readonly<ShellWorkerOptions>

    All options that this instance was created with.

    stderr: string[] = []

    All stderr combined. This will continue to be updated until the worker thread has exited.

    stdout: string[] = []

    All stdout combined. This will continue to be updated until the worker thread has exited.

    worker: Worker

    The underlying worker thread.

    This should not be used in normal circumstances.

    workerCommand: Readonly<WorkerCommand>

    The command that the shell worker thread is to execute.

    Methods

    • Attaches all listeners passed to this instance via options.

      Parameters

      • listeners:
            | undefined
            | Readonly<
                PartialWithUndefined<
                    {
                        WorkerExitEvent: MaybeArray<
                            (event: WorkerExitEvent) => MaybePromise<void>,
                        >;
                        WorkerStderrEvent: MaybeArray<
                            (event: WorkerStderrEvent) => MaybePromise<void>,
                        >;
                        WorkerStdoutEvent: MaybeArray<
                            (event: WorkerStdoutEvent) => MaybePromise<void>,
                        >;
                    },
                >,
            >

      Returns void

    • Terminate the worker and destroy this instance. This is the preferred way of forcefully exiting a worker.

      Returns Promise<void>

    • Post a message to the worker thread. Typically, you should not need to do this as the worker thread will take care of itself automatically.

      Parameters

      Returns void

      This should not be used in normal circumstances.

    • Wait for the worker to exit (if it hasn't already exited).

      Returns Promise<{ errors: Error[]; exitCode: number; stderr: string; stdout: string }>

    • Creates a worker, executes it, and waits for it to finish.

      Parameters

      Returns Promise<{ errors: Error[]; exitCode: number; stderr: string; stdout: string }>