From ef39866fa6e6ac91cc64f18573dea22c3f75c6e1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Jan 2015 09:17:51 +0000 Subject: consolidate spawn fix for Ruby [Bug #8770] Ensure we can apply the workaround to dtas-sourceedit and our test cases while also simplifying the existing call sites a little. This will also make for less code churn in 3-5 years down the line when we drop <= 2.1 support. --- lib/dtas/process.rb | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'lib/dtas/process.rb') diff --git a/lib/dtas/process.rb b/lib/dtas/process.rb index c0ce9a3..56e88e8 100644 --- a/lib/dtas/process.rb +++ b/lib/dtas/process.rb @@ -7,6 +7,7 @@ require_relative 'xs' module DTAS::Process # :nodoc: PIDS = {} include DTAS::XS + include DTAS::SpawnFix def self.reaper begin @@ -47,12 +48,7 @@ module DTAS::Process # :nodoc: opts = { close_others: true, pgroup: true }.merge!(opts) env = env_expand(env, opts) - pid = begin - Process.spawn(env, cmd, opts) - rescue Errno::EINTR - # workaround for older Rubies https://bugs.ruby-lang.org/issues/8770 - retry - end + pid = spawn(env, cmd, opts) warn [ :spawn, pid, cmd ].inspect if $DEBUG @spawn_at = Time.now.to_f PIDS[pid] = self @@ -76,12 +72,7 @@ module DTAS::Process # :nodoc: opts[:err] = we end env = env_expand(env, opts) - pid = begin - Process.spawn(env, *cmd, opts) - rescue Errno::EINTR - # workaround for older Rubies https://bugs.ruby-lang.org/issues/8770 - retry - end + pid = spawn(env, *cmd, opts) w.close if err_str we.close -- cgit v1.2.3-24-ge0c7