running "ruby" inside a rake task ignores JRUBY_OPTS
----------------------------------------------------

                 Key: JRUBY-5650
                 URL: http://jira.codehaus.org/browse/JRUBY-5650
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6
         Environment: Ubuntu Linux, running jRuby under RVM
            Reporter: Gonçalo Silva
            Assignee: Thomas E Enebo


I have a script called "works.rb". It's code is pretty simple:

{quote}
require 'jruby/profiler'

profile_data = JRuby::Profiler.profile do
  1000.times do |n| Hash.new end
end

profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
profile_printer.printProfile(STDOUT)}}
{quote}

If I run {{export JRUBY_OPTS="--profile.api" && ruby works.rb}} everything 
works as expected. Here's the output:

{quote}
Profiling enabled; ^C shutdown will now dump profile info

Total time: 0.02

 %total   %self       total        self    children                 calls  name
---------------------------------------------------------------------------------------------------------
   100%      0%        0.02        0.00        0.02                     1  (top)
                       0.02        0.01        0.01                   1/1  
Fixnum#times
---------------------------------------------------------------------------------------------------------
                       0.02        0.01        0.01                   1/1  (top)
   100%     43%        0.02        0.01        0.01                     1  
Fixnum#times
                       0.01        0.01        0.00             1000/1000  
Class#new
---------------------------------------------------------------------------------------------------------
                       0.01        0.01        0.00             1000/1000  
Fixnum#times
    56%     38%        0.01        0.01        0.00                  1000  
Class#new
                       0.00        0.00        0.00             1000/1000  
Hash#initialize
---------------------------------------------------------------------------------------------------------
                       0.00        0.00        0.00             1000/1000  
Class#new
    18%     18%        0.00        0.00        0.00                  1000  
Hash#initialize
{quote}

However, JRUBY_OPTS gets ignored when running "works.rb" inside a rake task. I 
have the following Rakefile:

{quote}
task :fails do
  ruby "works.rb"
end
{quote}

Running {{export JRUBY_OPTS="--profile.api" && rake fails}} returns:

{quote}
Profiling enabled; ^C shutdown will now dump profile info
(in /home/goncalossilva/Desktop)
** Invoke fails (first_time)
** Execute fails
/home/goncalossilva/.rvm/rubies/jruby-1.6.0/bin/jruby works.rb

Total time: 0.00

 %total   %self       total        self    children                 calls  name
---------------------------------------------------------------------------------------------------------
   100%    100%        0.00        0.00        0.00                     0  (top)
{quote}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to