Files
hermes-agent/apps
kshitijk4poor 02de0fa40f test(desktop): no-console-git fixture publishes its pid file atomically
The hanging-tree fixture's grandchild wrote pids.json with a plain
writeFileSync (open+truncate, then write) while the test polls
existsSync -> JSON.parse. A read landing between the truncate and the write
sees an empty file and throws "Unexpected end of JSON input" in port() or in
the cleanup, failing "app quit kills a timed git command ..." at random
(seen on PR #129573, whose diff touches no electron file).

Write to <file>.tmp and rename: rename is atomic on POSIX and Windows, so
existence now implies complete content for every reader.

Probe (same writer/reader shapes, separate processes, 300 runs each):
plain writeFileSync 12/300 torn reads, tmp+rename 0/300.

Regression from 4daeec7f2c (#127983), which rewrote the fixture around the
unsafe existsSync->parse read that c42db5415f introduced.
2026-10-01 01:41:41 +05:30
..