From: Tatsuki Sugiura Date: Tue, 15 Mar 2016 11:49:35 +0000 (+0900) Subject: Stop to launch web brwoser on non-x11 env. X-Git-Tag: v0.0.4^0 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7ae3cf11fb60653f4d3b35cc621de7760e0be251;p=osdn-codes%2Fosdn-cli.git Stop to launch web brwoser on non-x11 env. --- diff --git a/ChangeLog b/ChangeLog index b3fbbc8..523e1aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-03-15 Tatsuki Sugiura + * Version 0.0.4 + * login: stop to launch web browser on non-X11 environment. + +2016-03-15 Tatsuki Sugiura + + * Version 0.0.3 * frs_upload: show upload progres in verbose mode. * frs_upload: validates file digest after upload. diff --git a/lib/osdn/cli/command/login.rb b/lib/osdn/cli/command/login.rb index ddb3352..0e129ea 100644 --- a/lib/osdn/cli/command/login.rb +++ b/lib/osdn/cli/command/login.rb @@ -31,12 +31,14 @@ module OSDN; module CLI; module Command def launch_brwoser(url) puts "Access follwoing URL to get auth code;\n#{url}" - %w(/usr/bin/xdg-open /usr/bin/X11/xdg-open /usr/local/bin/xdg-open - /usr/bin/x-www-browser /usr/bin/firefox /usr/local/bin/firefox - ).each do |bin| - File.executable?(bin) or next - exec(bin, url) if fork.nil? - return + if ENV['DISPLAY'] + %w(/usr/bin/xdg-open /usr/bin/X11/xdg-open /usr/local/bin/xdg-open + /usr/bin/x-www-browser /usr/bin/firefox /usr/local/bin/firefox + ).each do |bin| + File.executable?(bin) or next + exec(bin, url) if fork.nil? + return + end end case RUBY_PLATFORM when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ diff --git a/lib/osdn/cli/version.rb b/lib/osdn/cli/version.rb index bbb2a4f..e4bdb51 100644 --- a/lib/osdn/cli/version.rb +++ b/lib/osdn/cli/version.rb @@ -1,5 +1,5 @@ module OSDN module CLI - VERSION = "0.0.3" + VERSION = "0.0.4" end end