Skip to content

Commit

Permalink
a little more robust check for autotest/textmate/etc
Browse files Browse the repository at this point in the history
  • Loading branch information
knzai committed Apr 15, 2010
1 parent ded99dc commit c02dff8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
if ENV['RAILS_ENV'] == 'test' && !%w{false none}.include?(ENV['BENCHMARK'])
while (pid ||= $$).to_i > 0
pid, *process = `ps -p #{pid} -o ppid -o args`.strip.split("\n").last.split
@autotest ||= process.join =~ /autotest|textmate|watch/i
end

require File.dirname(__FILE__) + "/lib/test_benchmark" unless @autotest
end
processes = "ruby"
begin
pgid = `ps -p #{$$} -o pgid`.split("\n").last
processes = `ps -o command -g #{pgid}`
rescue StandardError;
end
require File.dirname(__FILE__) + "/lib/test_benchmark" unless processes =~ /autotest|textmate|watch/i
end

0 comments on commit c02dff8

Please sign in to comment.