Under 5.5.1, and after compiling with polyc, the code below gives an assertion 
violation and core dump:

> $ ./a.out
> In parent - reading
> Assertion failed: (save_vec_addr < save_vec+1000), function push, file 
> save_vec.cpp, line 70.
> Abort trap: 6

(That's the OSX wording.  I get something very similar under Linux.)

I may well be making a hash of my POSIX programming, but I'd still hope for an 
exception rather than a core dump.

Michael

- - - -

fun mkTIO_instream fd =
  let
    open Posix.IO
    val (flags,_) = getfl fd
    val rdr = mkTextReader { fd = fd, name = "",
                             initBlkMode = O.anySet (flags, O.nonblock) }
  in
    TextIO.mkInstream (TextIO.StreamIO.mkInstream (rdr, ""))
  end

fun main() =
  let
    open Posix.Process Posix.IO
    val {infd,outfd} = pipe()
  in
    case fork () of
        NONE =>
        let
          val () = dup2{old = outfd, new = Posix.FileSys.stdout}
          val () = List.app close [infd, outfd]
        in
          exec("/bin/ls", ["ls", "."])
        end
      | SOME pid =>
        let
          val _ = print "In parent - reading\n"
          val strm = mkTIO_instream infd
          fun recurse () =
            case TextIO.inputLine strm of
                NONE => ()
              | SOME s => (print ("Child: " ^ s); recurse())
        in
          recurse();
          wait();
          print "Seen child's exit\n"
        end

  end

- - - -



________________________________

The information in this e-mail may be confidential and subject to legal 
professional privilege and/or copyright. National ICT Australia Limited accepts 
no liability for any damage caused by this email or its attachments.
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to