From b163bf637e9380b108722d29e93ddc5958f90723 Mon Sep 17 00:00:00 2001 From: ddavison Date: Sat, 24 Aug 2013 21:31:05 -0400 Subject: [PATCH] final mods --- bin/jekyll | 2 +- lib/jekyll/commands/serve.rb | 11 +++++------ lib/jekyll/configuration.rb | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 70a66a00..ddcbe123 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -82,7 +82,7 @@ command :serve do |c| c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' - c.option '-B', '--detach', 'Run this server in the background (detach)' + c.option '-B', '--detach', 'Run the server in the background (detach)' c.option '-D', '--drafts', 'Render posts in the _drafts folder' c.option '-P', '--port [PORT]', 'Port to listen on' diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 8ff4ec6a..406d3ef7 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -25,15 +25,14 @@ module Jekyll s.mount(options['baseurl'], HTTPServlet::FileHandler, destination, fh_option) - unless options['detach'] - t = Thread.new { s.start } - trap("INT") { s.shutdown } - t.join() - else - # they are detaching the server. + if options['detach'] # detach the server pid = Process.fork {s.start} Process.detach(pid) pid + else # create a new server thread, then join it with current terminal + t = Thread.new { s.start } + trap("INT") { s.shutdown } + t.join() end end end diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 0efc1d40..05a097c7 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -15,7 +15,7 @@ module Jekyll 'timezone' => nil, # use the local timezone 'safe' => false, - 'detach' => false, # don't default to detaching the server + 'detach' => false, # default to not detaching the server 'show_drafts' => nil, 'limit_posts' => 0, 'lsi' => false,