From 1f4fcec53bf68291deaa31a05023022c42c7e39a Mon Sep 17 00:00:00 2001 From: "Kevin W. Gisi" Date: Tue, 3 Aug 2010 13:25:54 +0800 Subject: [PATCH] Correctly check for failing Serve --- Rakefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index e8b6945..c6fca78 100644 --- a/Rakefile +++ b/Rakefile @@ -165,8 +165,11 @@ desc "start up an instance of serve on the output files" task :start_serve => :stop_serve do cd "#{site}" do print "Starting serve..." - ok_failed system("serve #{port} > /dev/null 2>&1 &") - system "open http://localhost:#{port}" + system("serve #{port} > /dev/null 2>&1 &") + sleep 1 + pid = `ps auxw | awk '/bin\\/serve\\ #{port}/ { print $2 }'`.strip + ok_failed !pid.empty? + system "open http://localhost:#{port}" unless pid.empty? end end