Hi --

On Sat, 6 Sep 2008, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "Re: [ruby-core:18461] Re: Global constants and other magic in 1.9	stdlib"
>    on Sat, 6 Sep 2008 01:03:04 +0900, Paul Brannan <pbrannan / atdesk.com> writes:
>
> |$_ is thread-local, but $? really is global:
> |
> |  rb_define_readonly_variable("$?", &rb_last_status);
> |
> |I'm sure there's a good reason, but I don't know what it is. (maybe
> |something to do with calling Process.wait from a signal handler?)
>
> Since $? is a result from waitpid, which is not always bound to a
> thread.

I'm wondering if I'm misinterpreting this as thread-local $? behavior,
and if it isn't, then what's accounting for the two $?'s:

>> t = Thread.new { system("ddddd"); Thread.stop; puts $? }
=> #<Thread:0x3b1b7c run>
>> system("date")
Fri Sep  5 18:12:32 EDT 2008
=> true
>> $?
=> #<Process::Status: pid 344 exit 0>
>> t.run
=> #<Thread:0x3b1b7c run>
pid 343 exit 127


David

-- 
Rails training from David A. Black and Ruby Power and Light:
   Intro to Ruby on Rails  January 12-15   Fort Lauderdale, FL
   Advancing with Rails    January 19-22   Fort Lauderdale, FL *
   * Co-taught with Patrick Ewing!
See http://www.rubypal.com for details and updates!