@runloop/api-client - v1.4.0
    Preparing search index...

    Execution object for tracking async command execution with streaming support.

    The Execution class represents an asynchronous command execution on a devbox. It provides methods to track the execution state, wait for completion, and control the execution (e.g., kill it if needed).

    Executions are typically created via devbox.cmd.execAsync():

    import { RunloopSDK } from '@runloop/api-client-ts';

    const runloop = new RunloopSDK();
    const devbox = runloop.devbox.fromId('devbox-123');

    // Start async execution with streaming
    const execution = await devbox.cmd.execAsync('npx http-server -p 8080', {
    stdout: (line) => console.log(`[LOG] ${line}`),
    stderr: (line) => console.error(`[ERROR] ${line}`),
    });

    // Do other work while command runs...

    // End the process early
    const excution.kill();
    Index

    Accessors

    Methods

    • Wait for the execution to complete and return the result. If streaming callbacks were provided, also waits for all streams to finish.

      Parameters

      • Optionaloptions: RequestOptions<unknown> & {
            polling?: Partial<PollingOptions<DevboxAsyncExecutionDetailView>>;
        }

        Request options with optional polling configuration

      Returns Promise<RunloopSDK.Devbox.ExecutionResult>

      ExecutionResult with stdout, stderr, and exit code

      const runloop = new RunloopSDK();
      const devbox = runloop.devbox.fromId('devbox-123');
      const execution = await devbox.cmd.execAsync('npm install');

      // Other work while command runs...

      const result = await execution.result();

      if (result.success) {
      console.log('Installation successful!');
      console.log(await result.stdout());
      } else {
      console.error('Installation failed:', await result.stderr());
      }
    • Get the current state of the execution.

      Parameters

      • Optionaloptions: RequestOptions<unknown>

      Returns Promise<DevboxAsyncExecutionDetailView>

      const execution = await devbox.cmd.execAsync('npx http-server -p 8080');
      const state = await execution.getState();
      console.log(`Status: ${state.status}`);
    • Kill the execution if it's still running.

      Parameters

      • Optionaloptions: RequestOptions<unknown>

        Request options

      Returns Promise<void>

      Promise that resolves when the execution is killed