Skip to main content
Start with the Runloop Quickstart to use the examples below.

Execute Commands

Once your Devbox is in a ready state you can execute commands to interact with it. The primary method of executing commands is the exec command.

Long Running Commands

You can use exec_async to return a command object that you can use to control command execution. This allows you to manage commands by running them in the background and control their lifecycle.
This function will return once the devbox has started the command execution. You can use the command object to control the command execution.

Streaming Output

You can stream stdout and stderr logs in real-time, this works for exec and execAsync.
Streaming is ideal for long-running commands where you want to see output as it’s generated, such as builds, tests, or log tailing.
1

Execute a command and stream output

2

Execute a command and stream STDOUT and STDERR

Isolated Shells

By default, every Devbox command runs in a new shell session so the state of the shell is not preserved between commands.

Stateful Shells

You can use the shell_name parameter to use a ‘stateful’ shell. This means that the shell will maintain its state across commands including environment variables and working directory. As an example, let’s create a series of interdependent commands that need to be run in the same shell:
1

Create and enter new directory

2

Check new working directory is preserved

3

Environment variables are preserved