Fix Ruby installer on macOS system Vim
- Do not use io/console - Interrupting threads crashes Vim, so don't do it Close #592 Related #537, #538
This commit is contained in:
parent
d1ac3cdd1f
commit
e80a93d5d0
1 changed files with 10 additions and 3 deletions
13
plug.vim
13
plug.vim
|
@ -1768,6 +1768,7 @@ function! s:update_ruby()
|
||||||
tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1
|
tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1
|
||||||
nthr = VIM::evaluate('s:update.threads').to_i
|
nthr = VIM::evaluate('s:update.threads').to_i
|
||||||
maxy = VIM::evaluate('winheight(".")').to_i
|
maxy = VIM::evaluate('winheight(".")').to_i
|
||||||
|
vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/
|
||||||
cd = iswin ? 'cd /d' : 'cd'
|
cd = iswin ? 'cd /d' : 'cd'
|
||||||
tot = VIM::evaluate('len(s:update.todo)') || 0
|
tot = VIM::evaluate('len(s:update.todo)') || 0
|
||||||
bar = ''
|
bar = ''
|
||||||
|
@ -1857,11 +1858,17 @@ function! s:update_ruby()
|
||||||
main = Thread.current
|
main = Thread.current
|
||||||
threads = []
|
threads = []
|
||||||
watcher = Thread.new {
|
watcher = Thread.new {
|
||||||
require 'io/console' # >= Ruby 1.9
|
if vim7
|
||||||
nil until IO.console.getch == 3.chr
|
while VIM::evaluate('getchar(1)')
|
||||||
|
sleep 0.1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
require 'io/console' # >= Ruby 1.9
|
||||||
|
nil until IO.console.getch == 3.chr
|
||||||
|
end
|
||||||
mtx.synchronize do
|
mtx.synchronize do
|
||||||
running = false
|
running = false
|
||||||
threads.each { |t| t.raise Interrupt }
|
threads.each { |t| t.raise Interrupt } unless vim7
|
||||||
end
|
end
|
||||||
threads.each { |t| t.join rescue nil }
|
threads.each { |t| t.join rescue nil }
|
||||||
main.kill
|
main.kill
|
||||||
|
|
Loading…
Reference in a new issue