From f533538e28bc96dfd5e9123b410d646936a43f8a Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 14 Aug 2008 22:34:19 +0000 Subject: [PATCH] Correct server shutdown code svn: r11264 --- collects/web-server/servlet-env.ss | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/collects/web-server/servlet-env.ss b/collects/web-server/servlet-env.ss index 399f8fdc41..20b8b8b9fd 100644 --- a/collects/web-server/servlet-env.ss +++ b/collects/web-server/servlet-env.ss @@ -119,7 +119,13 @@ new-servlet))) (when launch-browser? ((send-url) standalone-url #t)) - (printf "Your web application is running at ~a.~n" standalone-url) - (printf "Click 'Stop' at any time to terminate the web server.~n") - (semaphore-wait sema) + (printf "Your Web application is running at ~a.~n" standalone-url) + (printf "Click 'Stop' at any time to terminate the Web Server.~n") + (with-handlers + ([exn:break? + (lambda (exn) + (printf "~nWeb Server stopped.~n") + (shutdown-server))]) + (semaphore-wait/enable-break sema)) + ; We shouldn't get here, because nothing posts to the semaphore. But just in case... (shutdown-server))) \ No newline at end of file