Project

General

Profile

Actions

Bug #251

closed

$? is not thread scope

Added by Anonymous over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-dev:35414]

Description

=begin
1.9 では $? がスレッドスコープでなくなっているようです。

以下のように、他のスレッドで動かしたコマンドの結果が $? に表
れます。

% ./ruby -ve '
t = Thread.new { system("false") }
p $?
t.join
p $?
'
ruby 1.9.0 (2008-07-09 revision 17977) [i686-linux]
false
#<Process::Status: pid 11679 exit 1>

1.8 では $? は変化しません。

% ruby-1.8 -ve '
t = Thread.new { system("false") }
p $?
t.join
p $?
'
ruby 1.8.7 (2008-07-10 revision 17572) [i686-linux]
nil
nil

あと、ついでにいうと、1.9 では $? の初期値が 1.8 と異なり
false です。

Tanaka Akira
=end

Actions

Also available in: Atom PDF

Like0
Like0