@@ -389,23 +389,7 @@ void HttpServerStart(DatabaseInstance& db, string_t host, int32_t port, string_t
389389
390390 if (run_in_same_thread) {
391391#ifdef _WIN32
392- // Windows-specific handler for Ctrl+C
393- BOOL WINAPI consoleHandler (DWORD signal) {
394- if (signal == CTRL_C_EVENT) {
395- if (global_state.server ) {
396- global_state.server ->stop ();
397- }
398- global_state.is_running = false ; // Update the running state
399- return TRUE ; // Indicate that the signal was handled
400- }
401- return FALSE ;
402- }
403-
404- // Set the console control handler for Windows
405- if (!SetConsoleCtrlHandler (consoleHandler, TRUE )) {
406- std::cerr << " Error setting up signal handler" << std::endl;
407- throw IOException (" Failed to set up signal handler" );
408- }
392+ throw IOException (" Foreground mode not yet supported on WIN32 platforms." );
409393#else
410394 // POSIX signal handler for SIGINT (Linux/macOS)
411395 signal (SIGINT, [](int ) {
@@ -414,14 +398,14 @@ void HttpServerStart(DatabaseInstance& db, string_t host, int32_t port, string_t
414398 }
415399 global_state.is_running = false ; // Update the running state
416400 });
417- #endif
418-
401+
419402 // Run the server in the same thread
420403 if (!global_state.server ->listen (host_str.c_str (), port)) {
421404 global_state.is_running = false ;
422405 throw IOException (" Failed to start HTTP server on " + host_str + " :" + std::to_string (port));
423406 }
424-
407+ #endif
408+
425409 // The server has stopped (due to CTRL-C or other reasons)
426410 global_state.is_running = false ;
427411 } else {
0 commit comments