summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2009-11-23 07:09:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-11-24 05:31:01 (GMT)
commit0b624b4ceee63ce45135cdbb80f2807c20b48646 (patch)
treecd99912c9845ed8953f61fa358f12b89488cb882
parent1ddf5efc66d92282e3c654ebf263538a0df2ac24 (diff)
downloadgit-0b624b4ceee63ce45135cdbb80f2807c20b48646.zip
git-0b624b4ceee63ce45135cdbb80f2807c20b48646.tar.gz
git-0b624b4ceee63ce45135cdbb80f2807c20b48646.tar.bz2
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>
-rwxr-xr-xgit-instaweb.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-instaweb.sh b/git-instaweb.sh
index d96eddb..80a7f74 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -73,6 +73,11 @@ resolve_full_httpd () {
}
start_httpd () {
+ if test -f "$fqgitdir/pid"; then
+ say "Instance already running. Restarting..."
+ stop_httpd
+ fi
+
# here $httpd should have a meaningful value
resolve_full_httpd