add stdlibshims + catch EBADF

This commit is contained in:
craff 2021-12-11 20:29:58 -10:00
parent 91ca51ea42
commit 47d9ace8fd
3 changed files with 7 additions and 2 deletions

View file

@ -39,8 +39,12 @@ let rec write_out ({buf;fd;_} as oc) i len =
with Sys_blocked_io
| Unix.Unix_error((EAGAIN|EWOULDBLOCK),_,_) ->
write_out oc i len
| Unix.Unix_error(EPIPE,_,_) ->
| Unix.Unix_error((EPIPE|EBADF),_,_) ->
raise (Sys_error "broken pipe")
| e ->
Printf.eprintf "unexpected exception in write_out: %s\n%!"
(Printexc.to_string e);
assert false
let rec output ({buf;pos;_} as oc) s i len =
let buf_len = Bytes.length buf in

View file

@ -2,6 +2,6 @@
(library
(name tiny_httpd)
(public_name tiny_httpd)
(libraries threads)
(libraries threads stdlib-shims)
(flags :standard -safe-string -warn-error -a+8)
(wrapped false))

View file

@ -11,6 +11,7 @@ build: [
]
depends: [
"dune" { >= "2.0" }
"stdlib-shims"
"base-threads"
"ocaml" { >= "4.04.0" }
"odoc" {with-doc}