----- Original Message ----- 
From: "Sean Chittenden" <sean / chittenden.org>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Thursday, April 24, 2003 7:18 PM
Subject: Bug in chdir() in Ruby 1.6....


> This bit me while using ruby 1.6:
> 
> Dir.chdir("/tmp") do |d|
>   puts "in #{d}"
> end
> 
> Are there any plans on merging a yielding Dir.chdir() call back into
> 1.6?  The block is accepted as a parameter, but is silently ignored.
> There should be a check to see if there is a proc attached to the
> call or at the very least, yield if there is.
> 
>     if (rb_block_given_p()) {
>         char *cwd = my_getcwd();
>         chdir_blocking++;
>         if (chdir_thread == Qnil)
>             chdir_thread = rb_thread_current();
>         dir_chdir(dist);
>         return rb_ensure(rb_yield, path, chdir_restore, (VALUE)cwd);
>     }

I think this only makes sense if you
are using an older Ruby but are aware
of a newer one. (I'll bet shim handles
this, in other words.)

Lots of things allow blocks passed and
silently ignore the block.

If you fix one, you have to fix them
all, I think.

Hal