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

    Class DevboxCmdOps

    Command execution operations for a devbox. Provides methods for executing commands synchronously and asynchronously.

    Index

    Methods

    Methods

    • Execute a command on the devbox and wait for it to complete. Optionally provide callbacks to stream logs in real-time.

      When callbacks are provided, this method waits for both the command to complete AND all streaming data to be processed before returning.

      Parameters

      Returns Promise<RunloopSDK.Devbox.ExecutionResult>

      ExecutionResult with stdout, stderr, and exit status

      // Simple execution
      const result = await devbox.cmd.exec('ls -la');
      console.log(await result.stdout());

      // With streaming callbacks
      const result = await devbox.cmd.exec('npm install', {
      stdout: (line) => process.stdout.write(line),
      stderr: (line) => process.stderr.write(line),
      });
    • Execute a command asynchronously without waiting for completion. Optionally provide callbacks to stream logs in real-time as they are produced.

      Callbacks fire in real-time as logs arrive. When you call execution.result(), it will wait for both the command to complete and all streaming to finish.

      Parameters

      Returns Promise<RunloopSDK.Devbox.Execution>

      Execution object for tracking and controlling the command

      const execution = await devbox.cmd.execAsync('long-running-task.sh', {
      stdout: (line) => console.log(`[LOG] ${line}`),
      });

      // Do other work while command runs...

      const result = await execution.result();
      if (result.success) {
      console.log('Task completed successfully!');
      }