> -------- Original Message --------
> Subject: Re: [narwhal] Bug in file.js
> From: Paul Baumgart <pa...@baumgart.us>
> Date: Wed, September 29, 2010 12:34 pm
> To: narw...@googlegroups.com
>
>
> Do you have the latest version of Narwhal? This was fixed in August:
> http://github.com/280north/narwhal/commit/8584ceaea9d4aa73cc9d1f45774698c26bdafe43
>
> There's the potential for leaks if there's an error opening the files,
> so I just sent a pull request for a better version that try/catches:
> http://github.com/280north/narwhal/pull/16
>
> Paul
>
> On Tue, Sep 28, 2010 at 6:13 PM, ddoctor <ddo...@samplesurgeon.com> wrote:
> > Hi,
> >
> > The following section of file.js in narwhal is causing open file leaks
> > for us. Basically, one of the files is not being closed:
> >
> > exports.copy = function (source, target) {
> > source = exports.path(source);
> > target = exports.path(target);
> > source.open("rb").copy(target.open("wb")).close();
> > };
> >
> > I think it should be something like this:
> >
> > exports.copy = function (source, target) {
> > function open(mode, x) {
> > var p = exports.path(x);
> > p.open(mode);
> > return p;
> > }
> >
> > var s = open(source, "rb");
> > var t = open(target, "wb");
> > s.copy(t);
> > s.close();
> > t.close();
> > };
> >
> >
> > Cheers,
> >
> > ddoctor
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Narwhal and Jack" group.
> > To post to this group, send email to narw...@googlegroups.com.
> > To unsubscribe from this group, send email to narwhaljs+...@googlegroups.com.
> > For more options, visit this group at http://groups.google.com/group/narwhaljs?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups "Narwhal and Jack" group.
> To post to this group, send email to narw...@googlegroups.com.
> To unsubscribe from this group, send email to narwhaljs+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/narwhaljs?hl=en.