Version française
Home     About     Download     Resources     Contact us    
Browse thread
close_in or close_process_in ?!
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <oandrieu@n...>
Subject: Re: [Caml-list] close_in or close_process_in ?!
On Jan 21, 2008 1:27 AM, Oliver Bandel <oliver@first.in-berlin.de> wrote:
> Hello,
>
>
> I stumbled over a problem that I until now have not seen as a problem...

> So some questions arise:
>     *  negative signal-numbers - how can that be?

$ ocaml
        Objective Caml version 3.10.0

# Sys.sigpipe ;;
- : int = -8

The caml runtime library just uses negative signal numbers.

>     * why does that code not work?

It does work. It's just that since you close the channel before the
zcat process has finished writing all of the decompressed data, it
dies because it gets a SIGPIPE signal.

>       In a different tool I have included that compressed module
>       and it works well, tested even with the same gz-file.
>       Is there a bug in "id_of_file"?
>
>     * How can it be, that close_process_in as well as close_in
>       are working on variables of the same type?
>       Isn't this a hole in the typesystem?
>       Or can normally both functions, Unix.close_process_in as well
>       as Pervasives.close_in be used on that channels?
>       And: why is it not working here?

Unix.close_process_in calls Pervasives.close_in, ultimately. Before
that, it uses the channel to lookup in a hashtable the pid of the
child process, so as to wait() and report the status of the child
process.

-- 
  Olivier