From 7ae3cf11fb60653f4d3b35cc621de7760e0be251 Mon Sep 17 00:00:00 2001 From: Tatsuki Sugiura Date: Tue, 15 Mar 2016 20:49:35 +0900 Subject: [PATCH] Stop to launch web brwoser on non-x11 env. --- ChangeLog | 6 ++++++ lib/osdn/cli/command/login.rb | 14 ++++++++------ lib/osdn/cli/version.rb | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) 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 -- 2.11.0