File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ pub fn start_daemon(context: &dyn Context, enable_registry_watcher: bool) -> Res
5454 // Start the web server before doing anything more expensive
5555 // Please check with an administrator before changing this (see #1172 for context).
5656 info ! ( "Starting web server" ) ;
57- let _server = crate :: Server :: start ( None , false , context) ?;
57+ let server = crate :: Server :: start ( None , false , context) ?;
58+ let server_thread = thread:: spawn ( || drop ( server) ) ;
5859
5960 let config = context. config ( ) ?;
6061
@@ -104,7 +105,11 @@ pub fn start_daemon(context: &dyn Context, enable_registry_watcher: bool) -> Res
104105 ) ?;
105106
106107 // Never returns; `server` blocks indefinitely when dropped
107- Ok ( ( ) )
108+ // NOTE: if a failure occurred earlier in `start_daemon`, the server will _not_ be joined -
109+ // instead it will get killed when the process exits.
110+ server_thread
111+ . join ( )
112+ . map_err ( |_| failure:: err_msg ( "web server panicked" ) )
108113}
109114
110115fn cron < F > ( name : & ' static str , interval : Duration , exec : F ) -> Result < ( ) , Error >
You can’t perform that action at this time.
0 commit comments