Origami

Exec

Run a command in a workspace.

http
POST /v1/workspaces/{id}/exec

Runs one command line in the workspace and answers once it has ended and what it changed is stored. The guide Running commands explains how to use it.

Request

Field
commandRequired. A bash command line, 1 to 100,000 characters. Several lines are fine
cwdWhere the command starts: /workspace or a directory below it. Default /workspace
timeoutMsHow long the command may run, in milliseconds. At most, and by default, 30,000
JSON
{ "command": "ls -la && cat README.md", "cwd": "/workspace/app", "timeoutMs": 10000 }

Response

200 whenever the command ran, whatever its exit code.

JSON
{
  "stdout": "...",
  "stderr": "",
  "exitCode": 0,
  "cwd": "/workspace/app",
  "executor": "shell",
  "timedOut": false,
  "truncated": { "stdout": false, "stderr": false }
}
Field
stdout, stderrWhat the command wrote, up to 1 MiB each
exitCodeAs in bash: 0 for success. 124 when it ran out of time, 126 when it ran too many commands, 127 for a command that isn't there
cwdWhere the command ended. Pass it as cwd to go on from there
executorWhere the command ran. Always shell, the emulated shell, for now
timedOutWhether it was stopped for running too long
truncatedWhether stdout or stderr was cut at the limit

Errors

ErrorWhen
400 invalid_requestNo command, a command too long, or a cwd outside /workspace
404 not_foundNo such workspace in your organization
503 store_unavailableThe workspace's storage isn't configured or can't be reached
500 internalSomething failed in the service or in the storage behind it, such as the storage refusing requests for a moment. Try again

Order

Commands on one workspace run one after another, in the order they arrive. A command sees everything written to the workspace before it started, by any client, and its answer comes once its own changes are stored.