How to terminate a THttpAplication? lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- zen010101 · 2024-07-17 17:54 My program wants to exit normally after Ctrl-C is pressed, but I haven't been able to accomplish this under FPC 3.22/3.3.1. The following is a sample program fragment from the official (...\fpcsrc\packages\fcl-web\examples\httpapp, I only added the code to respond to Ctrl-C) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure signalHandler(signum: cint); cdecl;begin  if (signum = SIGTERM) or (signum = SIGINT) then  begin    Writeln('Exiting');    Application.Terminate;  // can not quit the application    //Raise Exception.Create('EXIT THE APPLICATION'); // this can exit the THttpApplication normally, you will see 'Done' output to the console.  end;end; begin  // Register SignalHandler  fpSignal(SIGINT, @signalHandler);  .  .   .  Application.Initialize;  Application.Port:=StrTointDef(ParamStr(2),8384);  Application.Title:='HTTP Demo application';  Application.Run;  Writeln('Done');end.  I noticed a bug report which was committed 4 years ago (https://gitlab.com/freepascal.org/fpc/source/-/issues/36741#original- reporter-info-from-mantis-luca-olivlucareporter-name-luca-olivetti), but until now it is still there too. ---------------------------------------------------------------------- PascalDragon · 2024-07-18 19:31 Quote from: zen010101 on July 17, 2024, 07:54:44 pm```pascal [...] ``` The forum does not use Markdown, but BBCodes, in this case [code=pascal][/code].