From 06ab708edfaf9161b91e12e7940f9f0144d23062 Mon Sep 17 00:00:00 2001 From: Jordon Bedwell Date: Sun, 27 Mar 2016 21:41:23 -0500 Subject: [PATCH] Don't blindly assume the last-system. As it was we assumed that any system that wasn't Windows or OS X must be Linux but the reality of that can be very unlikely. BSD is popular in some places and it's not Linux and this would cause an error there. If we do not know the launcher for a platform we should ship an error and have the user file a bug if they feel it necessary and skip the launch otherwise. --- lib/jekyll/commands/serve.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 69ea8ba7..1ca28a4c 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -127,15 +127,12 @@ module Jekyll private def launch_browser(server, opts) - command = - if Utils::Platforms.windows? - "start" - elsif Utils::Platforms.osx? - "open" - else - "xdg-open" - end - system command, server_address(server, opts) + address = server_address(server, opts) + return system "start", address if Utils::Platforms.windows? + return system "xdg-open", address if Utils::Platforms.linux? + return system "open", address if Utils::Platforms.osx? + Jekyll.logger.error "Refusing to launch browser; " \ + "Platform launcher unknown." end # Keep in our area with a thread or detach the server as requested