Skip to content

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: 10000

Parameters ​

ParameterTypeDescription
commandStringRequired. The command line to run.
outputStringName of a variable that receives the command's output (stdout and stderr, trimmed). Later steps read it as ${NAME}.
envMapExtra environment variables for the command.
timeoutIntegerMilliseconds 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_PLATFORM and MAESTRO_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 enable

Keep 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.