gitoria
All repositories: gitoria
1.7 KB
# hl:proc — child processes`run(command, options)` deliberately blocks the calling thread until the child exitsand its output pipes close. It returns `{ exit, lines, stderr }`; `binary = true`returns stdout as `data` (Bytes) instead of `lines`. A nonzero exit status is a result;a command that cannot start, or exceeds `timeout` (seconds), raises an Error.A signal exit is `128 + signal`.**In an event handler, `run()` stalls the whole event loop**, including HTTP routesand timer deliveries. Auto-await does not turn a blocking plugin call into a fibersuspension. This applies to the run form and a `--native` binary: `run` is theblocking twin of `spawn` (ticket #80) and waits on the calling thread.Use `run` for scripts and short synchronous work. For long jobs in a service, use`spawn` and finish the job in `on child.exit`; the timer handler returns afterstarting the child, allowing requests and subsequent timer ticks to run. Keep abusy flag when jobs must not overlap:```hybrielimport { spawn } from 'hl:proc'import { every } from 'hl:time'Boolean busy = falseclock = every(2)on clock.tick() {if (busy) { return null }busy = truechild = spawn('sleep 3')on child.exit(ev) {busy = falseconsole.log('job exited: ' + ev.exit)}on child.Error(e) {busy = falseconsole.log(e.message)}}```A child that cannot start reports Error rather than exit, so release job state inboth handlers. A killed child still reports exit. Subscribe to `child.line` fortext output or `child.data` with `{ binary = true }` for byte chunks. There is noimplicit shell; use `spawnArgs(['sh', '-c', command])` to request one explicitly.`hl:proc` has no JavaScript implementation.
Branches
Latest commits
- 1a687b15Merge branch 'w48-member-merge'mre
- 166c775fW48 report, logmre
- 1b4623f0Members merge pull requests: API route, button on /pulls and /pulls/N, one shared merge pathmre
- 1075c38cW48 mission, logmre
- 17bdd0d6V37/V39 missions, logmre
- 146de5f8Re-vendor gitoria to Hybriel set-day39 (51e921d7)mre
- e874e44dtests/status-keyed: app token lives 60 s so it outlives the gate's two restartsmre
- 270b8d61deploy.sh: DEPLOY_STOP_START=1 stops, waits for the old pid, then starts (mpackdb freeze, replaces the standby swap)mre
- 3f9235b8project.hl: drop the dummy /pulls/:n component route (hybriel#294 is fixed in day37)mre
- c90daf19Re-vendor gitoria to Hybriel set-day37 (f6b3d45b)mre
- 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre
- 154d333fMerge w39-create-api: POST /api/repos with a user token (#39)mre
- 149dd512Rewrite W39 reportmre
- e5385075Expect 401 for POST /api/repos without a tokenmre
- 1a76055cDocument repository creation APImre
- 4d779b3bAdd create-api gatemre
- 88563122Add POST /api/repos for user tokensmre
- b00860e3Create repositories with member checks in createRepoInmre
- 0a38f236Report repository creation API blockermre
- b5f72187Record malformed JSON blocker for repository creationmre