Mantis - Cadmium
Erweiterte Problemanzeige
103 general kleinerer Fehler immer 2012-07-28 06:55 2013-03-07 23:11
dobesv  
xclerc  
normal  
erledigt 1.4  
erledigt  
keine    
keine  
0000103: Unix.descr_of_in_channel stdin fails in OcamlJava, works in OCaml

It appears that the "stdin" channel isn't assigned a unix file descriptor in Cafesterol.

let () =
    let fd = Unix.descr_of_in_channel stdin
    and buf = String.create 1 in
    let chars_read = Unix.read fd buf 1 1
    in print_endline (if chars_read == 1 then buf else "")
;;

This results in :

Fatal error: exception Sys_error("invalid file descriptor")

I ran into this because a library I use was getting filehandles for stdin using the channel instead of looking at stdin directly.
Problem-Historie
2012-07-28 06:55 dobesv Neues Problem
2012-07-28 07:21 dobesv Problemnotiz hinzugefügt: 0000252
2013-03-07 23:11 xclerc Status neu => erledigt
2013-03-07 23:11 xclerc Lösung offen => erledigt
2013-03-07 23:11 xclerc Bearbeitung durch => xclerc

Notiz
(0000252)
dobesv   
2012-07-28 07:21   
I was able to workaround this by using Unix.stdin and Unix.stdout directly.