From: James Cowlishaw Date: 2009-06-04T23:41:28+09:00 Subject: Re: rubyscript2exe problem The Higgs bozo wrote: > > http://www.ruby-forum.com/topic/170355 > > http://letmegooglethatforyou.com/?q=rubyscript2exe+modify+frozen+string This fix is not reliable; assignment to $0 doesn't reallocate it's buffer, hence the new string may be truncated. Try this in a file test.rb: 10.times do $0 = $0 + "." puts "#{$0} (#{$0.size})" end You'll see the output: >ruby test.rb test.rb. (8) test.rb.. (9) test.rb... (10) test.rb.... (11) test.rb.... (11) test.rb.... (11) test.rb.... (11) test.rb.... (11) test.rb.... (11) test.rb.... (11) >Exit code: 0 The fix is to alias $0: $progname = $0 alias $PROGRAM_NAME $0 alias $0 $progname 10.times do $0 = $0 + "." puts "#{$0} (#{$0.size})" end The output is then correct: >ruby test.rb test.rb. (8) test.rb.. (9) test.rb... (10) test.rb.... (11) test.rb..... (12) test.rb...... (13) test.rb....... (14) test.rb........ (15) test.rb......... (16) test.rb.......... (17) >Exit code: 0 See http://github.com/cowlibob/rubyscript2exe for the complete fixed script. Cowlibob. -- Posted via http://www.ruby-forum.com/.