Skip to content

Commit 0b624b4

Browse files
bebarinogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1ddf5ef commit 0b624b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git-instaweb.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ resolve_full_httpd () {
7373
}
7474

7575
start_httpd () {
76+
if test -f "$fqgitdir/pid"; then
77+
say "Instance already running. Restarting..."
78+
stop_httpd
79+
fi
80+
7681
# here $httpd should have a meaningful value
7782
resolve_full_httpd
7883

0 commit comments

Comments
 (0)