You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cli: an interrupt can leave the temporary file -o writes, and the CLI never cancels a run #971
morphic compile -o out.json writes through a temporary file in the destination's directory and renames it into place. At c387e25c:
a SIGINT that arrives while .out.json.tmp<16 hex> is being written leaves that file behind (4,405 bytes in one run, 1,036,005 in another), next to an untouched out.json;
a SIGINT earlier, while compiling, leaves nothing.
Cause
replaceFile removes its temporary file on its error returns only (cmd/morphic/compile.go). The CLI installs no signal handling and runs on context.Background() (cmd/morphic/main.go), so the engine's cancellation path has no caller outside tests.
Direction
A proposal:
signal.NotifyContext for SIGINT and SIGTERM in main, with the context passed to engine.Run.
replaceFile removes its temporary file when the context ends mid-write. A second signal still kills the process outright, so the name pattern stays recognisable for cleanup.
Done when a test sends SIGINT to the built binary during the write, driven from the test rather than a shell job (which starts with SIGINT ignored), and finds no temporary file and the destination unchanged.
Priority: P4, rule 3 (tooling; it does not touch the golden spec's output). SIGINT at the temporary file's first appearance → .out.json.tmp… left behind (morphic @c387e25c).
Activity