calendar
All repositories: gitoria
2.4 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.Storage returned by `run` and process events is released after the runtimecopies it, including stdout, stderr and allocated error messages. `spawn` releases preparedarguments after fork and owns its iterator as part of the child's lifetime.There is no asynchronous `run` form; `spawn` is the event-based form.After `native/build.sh`, run `python3 plugins/proc/tests/memory.py`. This Linuxregression installs a counting host heap and makes 5,000 calls per command forboth `run` and `spawn`: empty output, small output, 64 KiB output, and exit 7.Each batch must retain zero native blocks, keep its fd count, leave no children,and grow RSS by at most 1 MiB after warmup. It does not depend on GC timing.
Branches
Latest commits
- 692346ed|||PR calendar28: handle an already-subscribed notification device in push checksAtlas
- bc2d7776|||PR WIP calendar28: preserve toggle focus and chip specificityAtlas
- 189c4c8c|||PR WIP calendar28: replace visual class state with View conditionsAtlas
- fff2f537Merge branch 'calendar31-lib' into mainAtlas
- 07cde3dc|||PR keep worker records out of the repo; README vendor is day72Atlas
- a753b0ab|||PR move shared calendar logic to libAtlas
- b32a921dMerge branch 'vendor-day72' into mainAtlas
- 60a0dd19|||PR Hybriel day72 (00c9dbb8) instead of the withdrawn day73Atlas
- 53f5464dMerge branch 'calendar26-day73' into mainAtlas
- 338499ec|||PR Keep reminder settings open during editing and rejected savesAtlas
- ad9e8d59|||PR Use framework page and popover state, Hybriel day73Atlas
- cab224a1Re-vendor calendar to verified Hybriel day73Atlas
- f9b8f918Merge branch 'calendar-vendor-day61' into mainAtlas
- 66341793|||PR Vendor Hybriel day61Atlas
- 36fc596bMerge branch 'vendor-day59' into mainAtlas
- b37cc1da|||PR Vendor Hybriel day59Atlas
- 05665102Merge branch 'vendor-day56' into mainAtlas
- 687296fb|||PR Vendor Hybriel day56Atlas
- a6166d4eMerge branch 'hl-standard-3' into mainAtlas
- 6d0eb3b0|||PR Calendar day add buttons only when signed in (Kunibert minor)Atlas