Run a command in a briq
briq_execExecute a command inside a running briq and return stdout, stderr and the exit code, for up to 60 s. Use for migrations, seeding, health checks, the commands of a sandbox briq (scripts, tests, builds), or anything you would run with docker exec. Anything that can take longer (a build, a test suite, a data load): pass async: true, which starts it and answers at once with an exec id; then briq_exec_result reads it (it waits 30 s a call, up to 45 with waitMs) and briq_exec_stop stops it. Async needs sh and setsid in the image, as most have. Keep the command under about 16 KB: send bigger input as stdin. A sleeping briq is woken first, with the sleeping briqs of its stack, so the call is slower; on a stopped one, the error says why.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cmd | Yes | argv, run without a shell: ["psql", "-c", "select 1"], not ["psql -c 'select 1'"]. For pipes, globs, && or $VARS: ["sh", "-c", "…"] | |
| env | No | Variables for this command only, over the briq's own: { NAME: value }. Kept off its command line, and out of status and the audit log | |
| briq | Yes | briq id (bq_…) | |
| async | No | Start it and answer at once with an exec id, for a command that can take over a minute; read it with briq_exec_result. A running command keeps its stack awake | |
| stdin | No | Text fed to the command's standard input | |
| clearEnv | No | Start it from an empty environment: only the briq's PATH, HOME and LANG, then env. So a variable of the briq (an API key) does not reach it | |
| stdinOpen | No | With async: keep its stdin open, to write to while it runs with briq_exec_input (a follow-up message, an approval) until eof. Not with stdin | |
| timeoutMs | No | Without async: 60000 by default and at most. With async: when to stop it, 3600000 (1 h) by default, 86400000 (24 h) at most |