From b95a51440b6378847c4ab5dd4cf9e96e18b5f241 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Jan 2015 09:04:18 +0000 Subject: avoid aliasing global "spawn" method This makes debugging, grepping, and following code confusing at times and also unexpected breaks usage of the global "spawn" method. --- lib/dtas/partstats.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/dtas/partstats.rb') diff --git a/lib/dtas/partstats.rb b/lib/dtas/partstats.rb index 76e4940..6c714b3 100644 --- a/lib/dtas/partstats.rb +++ b/lib/dtas/partstats.rb @@ -49,7 +49,7 @@ class DTAS::PartStats rv end - def spawn(trim_part, opts) + def partstats_spawn(trim_part, opts) rd, wr = IO.pipe env = opts[:env] env = env ? env.dup : {} @@ -58,7 +58,8 @@ class DTAS::PartStats opts = { pgroup: true, close_others: true, err: wr } pid = begin Process.spawn(env, CMD, opts) - rescue Errno::EINTR # Ruby bug? + rescue Errno::EINTR + # workaround for older Rubies https://bugs.ruby-lang.org/issues/8770 retry end wr.close @@ -74,7 +75,7 @@ class DTAS::PartStats stats = [] fails = [] do_spawn = lambda do |trim_part| - pid, rpipe = spawn(trim_part, opts) + pid, rpipe = partstats_spawn(trim_part, opts) rset[rpipe] = [ trim_part, "" ] pids[pid] = [ trim_part, rpipe ] end -- cgit v1.2.3-24-ge0c7