aboutsummaryrefslogtreecommitdiff
path: root/test/test_emit.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-19 09:53:37 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-19 09:53:37 +0200
commit6bd741bd512904dfec7c1aa2b7b2bd3dd4269681 (patch)
tree3d5eaeb467d8f403512a75643a9ca9e5eff43d65 /test/test_emit.ml
parent27a8fbdf738f7fdb4c9a42ec99f08855dbed440b (diff)
downloadcolitur-6bd741bd512904dfec7c1aa2b7b2bd3dd4269681.tar.gz
colitur-6bd741bd512904dfec7c1aa2b7b2bd3dd4269681.zip
fix(cli): guard the whole template read, not only the open
read_file guarded open_in_bin but left in_channel_length and really_input_string unguarded, so a path that opens but cannot be read as bytes -- a directory -- escaped as an uncaught Sys_error and crashed the program, leaking the open channel on every failure path. A template is user input; it must never crash the program. Wrap the whole read in Fun.protect so the channel closes on every path (success, exception, early return), matching the close-on-every-path pattern already used in the test suite. The missing-file message stays exactly as before; a read failure after a successful open now carries the exception text, the same path: exception shape Layer.load and Overlay.load already use. New cram case points --template at a directory (the sandbox's own cwd, not /tmp) and asserts one stderr line and exit 2, not a crash.
Diffstat (limited to 'test/test_emit.ml')
0 files changed, 0 insertions, 0 deletions