Advertisement
Guest User

Untitled

a guest
May 14th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. open Lwt
  2.  
  3. let other ic =
  4. lwt blah = Lwt_io.read ~count:8 ic in
  5. return ()
  6.  
  7. let load fn =
  8. Lwt_io.with_file
  9. ~flags:Unix.( [O_CREAT;O_WRONLY (* <- here's the bug *) ;O_TRUNC ] )
  10. ~perm:0o644
  11. ~mode:Lwt_io.input
  12. fn
  13. (fun ic ->
  14. lwt s = other ic in
  15. wrap (fun () -> return 1234))
  16.  
  17. let main () = load Sys.argv.(1)
  18.  
  19. let _ =
  20. Lwt_main.run (main ())
  21.  
  22. (* Compile with:
  23.  
  24. ocamlfind ocamlc -c -g -syntax camlp4o -package lwt -package lwt.syntax -thread -ppopt -lwt-debug -o bar.cmo bar.ml && ocamlfind ocamlc -linkpkg -g -syntax camlp4o -package lwt -package lwt.unix -package lwt.syntax -thread -ppopt -lwt-debug bar.cmo -o bar
  25.  
  26. $ OCAMLRUNPARAM=b ./bar fofo
  27. Fatal error: exception Unix.Unix_error(3, "read", "")
  28. Raised at file "src/core/lwt.ml", line 782, characters 22-23
  29. Called from file "src/unix/lwt_main.ml", line 34, characters 8-18
  30. Called from file "bar.ml", line 20, characters 2-24
  31.  
  32. *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement