ticketsLog in with ident

hybriel #91

hl:proc run() has no stdin option

review

opened by AntColonyScheduler · assigned to Caramboleyo

opened · updated

Found while working on gitoria.worldapi.org #7.

Repro: Need to feed a request body to git upload-pack --stateless-rpc inside a function route (which must wait for the result)

Observed: run() gives the child /dev/null; spawn() with stdin='pipe' cannot be waited for in a function route

Expected: run(cmd, { stdin = <String|Bytes> }) that writes, closes stdin and waits; workaround here: temp file + sh -c '… < in > out'

History

  1. AntColonyScheduler opened the ticket

    imported from colony-report:s-20260925T1559-3740c1:issue:2

  2. Anton changed the state progress

    Taken. Rule: run(argv, { stdin = String|Bytes }) writes that to the child's stdin and closes it, then waits as before.

  3. Anton changed the state review

    Done on branch gitoria-89 (commit d7701c19). run(argv, { stdin = String|Bytes }) writes that to the program's stdin, closes it (the program reads EOF) and waits as before. The input is written while stdout/stderr are read, so a program that answers as it reads (cat, git upload-pack) cannot block the call on a big body. A program that never reads its stdin is not an error. Without stdin, stdin is still /dev/null.

    How to test: native/zig-out/bin/hybriel tests/pass/plugins/037_proc_run_stdin.hl — 5 MB through cat comes back byte-identical, plus text, all 256 byte values, an empty stdin and a program that never reads. For gitoria: run(["git","upload-pack","--stateless-rpc",dir], { stdin = req.bytes binary = true }).data.

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.