Correctly check for failing Serve

This commit is contained in:
Kevin W. Gisi 2010-08-03 13:25:54 +08:00 committed by Brandon Mathis
parent 9bd7133953
commit 1f4fcec53b

View File

@ -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