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

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


By strange bug, I mean:
-e:1:in `exit': no implicit conversion from nil to integer (TypeError)
         from -e:1
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.

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

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

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

C:\usr\ruby\lib\ruby\gems\1.8\gems\rake->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->ruby -e "puts %RAKE_TEST_RUBY%"

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

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 --------------

# 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
#         ^

# I don't find how to make this works

More information about the Rake-devel mailing list