Re: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread David Brown
On Mon, Oct 25, 2004 at 09:42:13PM +, John Goerzen wrote: > > Maybe I misunderstood something ... but why do you need to > > read from the stream multiple times after calling > > hGetContents? The function returns the _entire_ (lazily > > evaluated) input stream, there is no need to read again

Re: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread John Goerzen
On 2004-10-25, Peter Simons <[EMAIL PROTECTED]> wrote: > John Goerzen writes: > > > Now, if [I read with hGetContents h], then the first read > > I try to make using it works, but subsequent ones don't, > > since the first one made it half-closed already. > > Maybe I misunderstood something ... but

Re: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread Peter Simons
John Goerzen writes: > Now, if [I read with hGetContents h], then the first read > I try to make using it works, but subsequent ones don't, > since the first one made it half-closed already. Maybe I misunderstood something ... but why do you need to read from the stream multiple times after ca

Re: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread John Goerzen
On 2004-10-25, Simon Marlow <[EMAIL PROTECTED]> wrote: >> If I tried that with a single Handle opened ReadWrite, then I'd get >> errors about it being closed whenever I'd try to write out some data. >> >> I wasn't able to find any other good way around it. > > Hmmm, you should still be able to *wr

RE: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread Simon Marlow
On 25 October 2004 14:24, John Goerzen wrote: > On 2004-10-25, Simon Marlow <[EMAIL PROTECTED]> wrote: >> On 22 October 2004 21:58, Peter Simons wrote: >> >> On 24 October 2004 23:37, John Goerzen wrote: >> >>> * What happens when one Handle corresponding to a socket is closed, >>> but another

Re: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread John Goerzen
On 2004-10-25, Simon Marlow <[EMAIL PROTECTED]> wrote: > On 22 October 2004 21:58, Peter Simons wrote: > > On 24 October 2004 23:37, John Goerzen wrote: > >> * What happens when one Handle corresponding to a socket is closed, >> but another isn't? > > You shouldn't have two Handles on the same so

Re: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread Peter Simons
Simon Marlow writes: > BTW, I assume you have a good reason for wanting to call > terminateProcess Yes, I have to abort the process in case of an exception in my code. Just giving it EOF is not enough, unfortunately. Thanks a lot for taking the time to answer, Simon. I really appreciate it. P

RE: Are handles closed automatically when they fall out of scope?

2004-10-25 Thread Simon Marlow
On 22 October 2004 21:58, Peter Simons wrote: > I know it's a rather mundane question, but I couldn't find > an answer to it! > > So what does happen when I forget to hClose a Handle? Will > the garbage collector do that for me? Or not? Yes, a Handle will be automatically closed sometime after i

Re: Are handles closed automatically when they fall out of scope?

2004-10-24 Thread John Goerzen
On 2004-10-22, Peter Simons <[EMAIL PROTECTED]> wrote: > I know it's a rather mundane question, but I couldn't find > an answer to it! > > So what does happen when I forget to hClose a Handle? Will > the garbage collector do that for me? Or not? I'd like the answer to this question, too, but also: