Skip to content

Commit 32d4196

Browse files
committed
Merge tag 'main' of github.com:slavaGanzin/await
# Conflicts: # .github/workflows/c-cpp.yml # README.md # await.c
2 parents 1a4a80e + d5ac25b commit 32d4196

3 files changed

Lines changed: 3 additions & 30 deletions

File tree

README.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -153,36 +153,6 @@ await 'ps aux | head -10' --watch --interval 2000
153153
await 'tail -5 /var/log/system.log' --watch
154154
```
155155

156-
## For AI Agents
157-
158-
`await` is the missing primitive for AI agent scripts. Instead of fragile `sleep` loops, give your agent a single command that blocks until the world catches up — then proceeds.
159-
160-
```bash
161-
# Wait for a service to become healthy (5s per attempt, give up after 30s)
162-
await 'curl -sf localhost:3000/health' -t 5 -T 30000
163-
164-
# Wait for a Kubernetes pod to be running
165-
await 'kubectl get pod app -o jsonpath={.status.phase} | grep Running' -t 3 -T 60000
166-
167-
# Wait for a file the agent wrote asynchronously
168-
await 'test -f /tmp/result.json'
169-
170-
# Wait for database to accept connections
171-
await 'pg_isready -h localhost' -t 2 -T 30000
172-
173-
# Wait for deployment, then run smoke tests
174-
await 'curl -sf https://myapp.com/health' -t 3 -T 60000 --exec 'pytest tests/smoke/'
175-
```
176-
177-
Key flags for agents:
178-
- `-t <seconds>` — kill each attempt after N seconds and retry (prevents zombie processes from hanging connections)
179-
- `-T <milliseconds>` — global deadline — never let an agent block forever
180-
- `--exec` — chain the next step once the condition is met, with `\1` `\2` stdout substitution
181-
182-
Exit codes: `0` = condition met, `1` = timed out.
183-
184-
> Full machine-readable docs: https://await.beer/llms.txt
185-
186156
## --help
187157
```bash
188158
await [options] commands

await

19.1 KB
Binary file not shown.

await.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ char * highlight_differences(const char *old_text, const char *new_text) {
407407
}
408408
}
409409
}
410+
411+
sprintf(out[i], "%s%s", out[i], buf);
412+
if (!silent && verbose) printf("\n\n%s", buf);
410413
}
411414

412415
// Close highlighting if still open

0 commit comments

Comments
 (0)