@matheusbsbs / matheus-bagliano / commits / 0b624b4cee
Fork 0

instaweb: restart server if already running

Running 'git instaweb' when an instaweb server is already running will fail (at least when the port is the same) and overwrite the pid file used to track the currently running server. This turns out to be especially annoying when the user tries to stop the previously running server with 'git instaweb --stop' and is instead greeted with an error message because the pid file has been destroyed. Instead of allowing a user to start two instaweb servers, stop the currently running server first and then start the new one. This should be fine because it was never really possible to start two instaweb servers in the first place due to the pid file issue outlined above. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stephen Boyd committed Nov 22, 2009 at 23:09 UTC 0b624b4ceee63ce45135cdbb80f2807c20b48646
1 file changed +5
git-instaweb.sh
+5
@@ -73,6 +73,11 @@ resolve_full_httpd () {
73 }
74
75 start_httpd () {
76 + if test -f "$fqgitdir/pid"; then
77 + say "Instance already running. Restarting..."
78 + stop_httpd
79 + fi
80 +
81 # here $httpd should have a meaningful value
82 resolve_full_httpd
83