>> > In the other hand, on assert_normal_exit(), io.close is called from
>> > sub thread. it's a source
>> > of difference.
>>
>> Right, it changes the order of termination.
>
> Err, no, it doesn't. the popen process still ends before the thread. I
> don't see why io.close would be a source of difference?

In ruby internal, system(), io.close do 1) wait to finish child process *and*
2) set a last exit code of a child process to caller thread's thread
local variable.

In the other word, $? is a more magical variable than you did expect. ;-)


btw, please imazine what's happen if $? is true global variable, it's
completely useless.



> Debian GNU/Linux:
> PID: 27610
> hello
> Retval: 42
>
> FreeBSD:
> PID: 1172
> hello
> Retval: 42
>
> Debian GNU/kFreeBSD:
> ./debian-kfreebsd-amd64:~# ./forkthread
> PID: 719
> waitpid: No child processes
>
> Do you still want to apply my patch? I could apply it only in the Debian
> package if you prefer.

It would be better. Thanks.