@runloop/api-client - v2.0.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

    • Send nonempty input to the execution's stdin. Start it with attach_stdin: true. Await each send before the next send or closeStdIn(). Concurrent requests are not ordered. The generated client's retry policy is preserved: a retry after an ambiguous connection failure can replay input; delivery is not exactly once.

      Parameters

      • input: string

        The text to write to stdin

      • Optionaloptions: RequestOptions<unknown>

        Request options

      Returns Promise<void>

      Promise that resolves once the input has been delivered

      const execution = await devbox.cmd.execAsync('cat', { attach_stdin: true });
      await execution.sendStdIn('Hello from stdin!\n');
      await execution.closeStdIn();
      const result = await execution.result();

      If the API reports that the input was not delivered

    • Close the execution's stdin by sending EOF, so commands that read until end of input can finish.

      Parameters

      • Optionaloptions: RequestOptions<unknown>

        Request options

      Returns Promise<void>

      Promise that resolves once EOF has been delivered

      If the API reports that EOF was not delivered

    • 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