runShell
Run a shell command on the Mac and optionally keep its output.
The runShell command runs a command on the computer that runs Astra Scout, not on the device. Use it for tools such as adb, xcrun simctl or curl that prepare or check the test. The command runs with sh -c, so pipes, redirection and quoting work as written.
Syntax
yaml
- runShell: echo hello
# or
- runShell:
command: curl -s https://example.com/api/token
output: TOKEN
env:
API_KEY: abc123
timeout: 10000Parameters
| Parameter | Type | Description |
|---|---|---|
command | String | Required. The command line to run. |
output | String | Name of a variable that receives the command's output (stdout and stderr, trimmed). Later steps read it as ${NAME}. |
env | Map | Extra environment variables for the command. |
timeout | Integer | Milliseconds before the command is stopped. Defaults to 30000. |
Behavior
- The step fails if the command exits with an error or times out. The output is still stored in
output. - Only the last 64 KB of output is kept.
- The command sees your environment, the flow variables,
env, and these values for the device under test:MAESTRO_DEVICE_ID,MAESTRO_PLATFORMandMAESTRO_APP_ID.
Usage example
Turn on Wi-Fi on the connected Android device. MAESTRO_DEVICE_ID selects the right device when several are connected:
yaml
- runShell: adb -s $MAESTRO_DEVICE_ID shell svc wifi enableKeep a value for later:
yaml
- runShell:
command: date +%s
output: NOW
- inputText: ${NOW}The command runs on your Mac
Do not run commands from flows you do not trust.
