提交 c6be41f0 编写于 作者: M Mislav Marohnić

don't use pager on windows

Windows doesn't support `fork`.

Closes #97
上级 778b3fbc
......@@ -742,7 +742,7 @@ help
# http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby
def page_stdout
return unless $stdout.tty?
return if not $stdout.tty? or windows?
read, write = IO.pipe
......
......@@ -294,16 +294,25 @@ module Hub
#
# Returns an array, e.g.: ['open']
def browser_launcher
require 'rbconfig'
browser = ENV['BROWSER'] ||
(RbConfig::CONFIG['host_os'].include?('darwin') && 'open') ||
(RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw|windows/ && 'start') ||
browser = ENV['BROWSER'] || (
osx? ? 'open' : windows? ? 'start' :
%w[xdg-open cygstart x-www-browser firefox opera mozilla netscape].find { |comm| which comm }
)
abort "Please set $BROWSER to a web launcher to use this command." unless browser
Array(browser)
end
def osx?
require 'rbconfig'
RbConfig::CONFIG['host_os'].to_s.include?('darwin')
end
def windows?
require 'rbconfig'
RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw|windows/
end
# Cross-platform way of finding an executable in the $PATH.
#
# which('ruby') #=> /usr/bin/ruby
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册