[Groonga-commit] ranguba/rroonga at 9ba86dd [master] Reduce needless running external command

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Oct 29 00:07:05 JST 2014


Kouhei Sutou	2014-10-29 00:07:05 +0900 (Wed, 29 Oct 2014)

  New Revision: 9ba86dd77e1b97e1620a93c379323c56a81b6a54
  https://github.com/ranguba/rroonga/commit/9ba86dd77e1b97e1620a93c379323c56a81b6a54

  Message:
    Reduce needless running external command

  Modified files:
    ext/groonga/extconf.rb

  Modified: ext/groonga/extconf.rb (+1 -1)
===================================================================
--- ext/groonga/extconf.rb    2014-10-29 00:05:03 +0900 (71f5b06)
+++ ext/groonga/extconf.rb    2014-10-29 00:07:05 +0900 (1df4791)
@@ -171,7 +171,7 @@ def n_processors
   proc_file = "/proc/cpuinfo"
   use_processors = 1
   if File.exist?(proc_file)
-    cpu_nums = `cat #{proc_file} | grep processor | wc -l`
+    cpu_nums = File.readlines(proc_file).grep(/^processor/).size
   elsif /darwin/ =~ RUBY_PLATFORM
     cpu_nums = `sysctl -n hw.ncpu`
   end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index