Menu

Scripting the Sandscale CLI: exit codes, JSON output and when to switch to an API key
📰

Scripting the Sandscale CLI: exit codes, JSON output and when to switch to an API key

DEV Community: tutorial·Sandscale·9 days ago
#HI9AW5Yl
#devtotutorial#devto#dev#sandscale#exit
Long article (925 words) — no AI summary yet.
Reading 0:00
15s threshold

Short answer: the sandscale CLI is built to be scripted. sandscale sandbox exec and sandscale sandbox run exit with the remote command's own exit code, so make , set -e and && chains work as if the command ran locally. For everything else, a fixed set of exit codes tells your script what kind of failure it hit, and --json gives machine-readable output. For CI and servers, use a personal API key with the SDK or the API rather than a CLI sign-in; Sandscale's authentication docs recommend that.

All commands and codes here are from the live CLI reference , which is generated from the CLI itself.

The exit codes

From the sandscale sandbox reference :

Code Meaning

0 Done (for exec and run : the command's own code)

1 Failed

2 Usage error

3 No session (run sandscale login )

4 Refused

5 Not found

6 Conflict

7 Rate limited

One thing to watch: for exec and run , the remote command's exit code passes through, so a test runner that exits 1 and a CLI failure that exits 1 look the same to your script.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.