OSDN Git Service

Stop to launch web brwoser on non-x11 env. v0.0.4
authorTatsuki Sugiura <sugi@nemui.org>
Tue, 15 Mar 2016 11:49:35 +0000 (20:49 +0900)
committerTatsuki Sugiura <sugi@nemui.org>
Tue, 15 Mar 2016 11:49:35 +0000 (20:49 +0900)
ChangeLog
lib/osdn/cli/command/login.rb
lib/osdn/cli/version.rb

index b3fbbc8..523e1aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-03-15  Tatsuki Sugiura  <sugi@nemui.org>
 
+       * Version 0.0.4
+       * login: stop to launch web browser on non-X11 environment.
+
+2016-03-15  Tatsuki Sugiura  <sugi@nemui.org>
+
+       * Version 0.0.3
        * frs_upload: show upload progres in verbose mode.
        * frs_upload: validates file digest after upload.
 
index ddb3352..0e129ea 100644 (file)
@@ -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/
index bbb2a4f..e4bdb51 100644 (file)
@@ -1,5 +1,5 @@
 module OSDN
   module CLI
-    VERSION = "0.0.3"
+    VERSION = "0.0.4"
   end
 end