about summary refs log tree commit homepage
path: root/bin/dtas-partstats
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dtas-partstats')
-rwxr-xr-xbin/dtas-partstats12
1 files changed, 3 insertions, 9 deletions
diff --git a/bin/dtas-partstats b/bin/dtas-partstats
index 388f7ba..6a0c9d4 100755
--- a/bin/dtas-partstats
+++ b/bin/dtas-partstats
@@ -1,5 +1,5 @@
 #!/usr/bin/env ruby
-# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
+# Copyright (C) all contributors <dtas-all@nongnu.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 # frozen_string_literal: true
 # TODO
@@ -8,17 +8,11 @@
 # - configurable output formatting
 # - Sequel/SQLite support
 require 'dtas/partstats'
+require 'etc'
 infile = ARGV[0] or abort "usage: #$0 INFILE"
 ps = DTAS::PartStats.new(infile)
 
-def nproc
-  require 'etc'
-  Etc.nprocessors
-rescue NoMethodError
-  `nproc 2>/dev/null || echo 2`.to_i
-end
-
-opts = { jobs: nproc }
+opts = { jobs: Etc.nprocessors }
 stats = ps.run(opts)
 
 headers = ps.key_idx.to_a