lib/guard/rack/custom_process.rb in guard-rack-2.2.0 vs lib/guard/rack/custom_process.rb in guard-rack-2.2.1

- old
+ new

@@ -4,15 +4,15 @@ class Rack class CustomProcess attr_reader :options def self.new(options = {}) - if Gem.win_platform? - os_instance = Windows.allocate - else - os_instance = Nix.allocate - end + os_instance = if Gem.win_platform? + Windows.allocate + else + Nix.allocate + end os_instance.send :initialize, options os_instance end def initialize(options) @@ -22,22 +22,22 @@ class Nix < Rack::CustomProcess def kill(pid, force = false) result = -1 UI.debug("Trying to kill Rack (PID #{pid})...") unless force - Process.kill('INT', pid) + ::Process.kill('INT', pid) begin Timeout.timeout(options[:timeout]) do - _, status = Process.wait2(pid) + _, status = ::Process.wait2(pid) result = status.exitstatus UI.debug("Killed Rack (Exit status: #{result})") end rescue Timeout::Error UI.debug("Couldn't kill Rack with INT, switching to TERM") force = true end end - Process.kill('TERM', pid) if force + ::Process.kill('TERM', pid) if force result end end class Windows < Rack::CustomProcess