提交 0b624b4c 编写于 作者: S Stephen Boyd 提交者: Junio C Hamano

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: NStephen Boyd <bebarino@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 1ddf5efc
...@@ -73,6 +73,11 @@ resolve_full_httpd () { ...@@ -73,6 +73,11 @@ resolve_full_httpd () {
} }
start_httpd () { start_httpd () {
if test -f "$fqgitdir/pid"; then
say "Instance already running. Restarting..."
stop_httpd
fi
# here $httpd should have a meaningful value # here $httpd should have a meaningful value
resolve_full_httpd resolve_full_httpd
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册