From c74fae9f8ecaae201bf43f7a326b75322e444228 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 17 Feb 2015 20:59:22 +0900 Subject: [PATCH] Revert "Use :pgroup option when starting subprocesses" This reverts commit 308fb9bc94770557b0974009756691bc57d03918. --- plug.vim | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/plug.vim b/plug.vim index 32cf7b7..8f2680e 100644 --- a/plug.vim +++ b/plug.vim @@ -1004,36 +1004,23 @@ function! s:update_ruby() %["#{arg.gsub('"', '\"')}"] end - require 'rubygems' + def killall pid + pids = [pid] + unless `which pgrep 2> /dev/null`.empty? + children = pids + until children.empty? + children = children.map { |pid| + `pgrep -P #{pid}`.lines.map { |l| l.chomp } + }.flatten + pids += children + end + end + pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } + end + require 'thread' require 'fileutils' require 'timeout' - - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9') - def popen cmd - IO.popen(cmd, :pgroup => true) - end - def killall pid - Process.kill 'TERM', - pid rescue nil - end - else - def popen cmd - IO.popen(cmd) - end - def killall pid - pids = [pid] - unless `which pgrep 2> /dev/null`.empty? - children = pids - until children.empty? - children = children.map { |pid| - `pgrep -P #{pid}`.lines.map { |l| l.chomp } - }.flatten - pids += children - end - end - pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } - end - end running = true iswin = VIM::evaluate('s:is_win').to_i == 1 pull = VIM::evaluate('s:update.pull').to_i == 1 @@ -1100,7 +1087,7 @@ function! s:update_ruby() File.unlink tmp rescue nil end else - fd = popen(cmd).extend(PlugStream) + fd = IO.popen(cmd).extend(PlugStream) first_line = true log_prob = 1.0 / nthr while line = Timeout::timeout(timeout) { fd.get_line }