[Rake-devel] the origin of the strange bug on win2k

Lionel Thiry lthiry at skynet.be
Wed May 4 22:14:48 EDT 2005


Hello!

By strange bug, I mean:
----8<----
-e:1:in `exit': no implicit conversion from nil to integer (TypeError)
         from -e:1
----8<----
that appeared /while/ unittests of rake were running.

I think it is because comspec (the win2k shell) doesn't substitute variables the 
same way as unix shell does.

----8<----
C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>set RAKE_TEST_RUBY=123

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>echo $RAKE_TEST_RUBY
$RAKE_TEST_RUBY

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>echo %RAKE_TEST_RUBY%
123

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>ruby -e "exit $RAKE_TEST_RUBY"
-e:1:in `exit': no implicit conversion from nil to integer (TypeError)
         from -e:1

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake-0.5.4.1>ruby -e "puts %RAKE_TEST_RUBY%"
123
----8<----

Concerning the tests, the problem lies in test/testfileutils.rb at line 99:
----8<----
ruby %{-e "exit $RAKE_TEST_RUBY"} do |ok, status|
  assert(!ok)
  assert_equal 123, status.exitstatus
  block_run = true
end
----8<----

Unfortunatly, replacing $RAKE_TEST_RUBY with %RAKE_TEST_RUBY% doesn't work. I've 
conducted some tests to see what could work, see the attachment. ... But I don't 
find any solution yet.

-- 
Lionel Thiry

Personal website: http://users.skynet.be/lthiry/
-------------- next part --------------
ENV['RAKE_TEST_RUBY'] = "123"

# prooves RAKE_TEST_RUBY is set for subshell
puts %x{set}.split.include?("RAKE_TEST_RUBY=123")

# prooves ENV is correctly set for sub-ruby
puts %x{ruby -e "puts ENV['RAKE_TEST_RUBY']"} == "123\n"

# prooves RAKE_TEST_RUBY is set for subshell in sub-ruby
puts %x{ruby -e "puts %x{set}"}.split.include?("RAKE_TEST_RUBY=123")

# this code perfectly works in a dos box:
# > ruby -e "puts %RAKE_TEST_RUBY%"
# 123

# but there is a conflict with ruby use of %
puts %x{ruby -e "puts %RAKE_TEST_RUBY%"}
# output:
# -e:1: unknown type of %string
# puts %RAKE_TEST_RUBY%
#         ^

# I don't find how to make this works


More information about the Rake-devel mailing list