Le Wednesday 12 December 2007 03:46:56 Romain Beauxis, vous avez écrit :
> Also, we should take care of process output from system() calls and co.. ?
> I've tested closing stdout while liq uses scripts that output to stdout,
> seems it works, but needs to be confirmed...

As David already noticed:
let () =
  let kind = Lang.fun_t [false,"",Lang.string_t] Lang.unit_t in
  Lang.builtins#register "system"
    ~doc:(mkdoc ~cat:Sys "Shell command call." kind)
    { t = kind ;
      value = FFI (["",None],[],
                   fun p ->
                     ignore (Unix.system (Lang.to_string (List.assoc "" p))) ;
                     Lang.Unit) }

Unix.system doesn't crash if stdout and stderr are closed...

David; is there any possible tricky situation ?


Romain

Répondre à