Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
How to terminate a THttpAplication?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
This worries me about our...
by
zeljko
[
Today
at 10:40:33 pm]
Problem with Qt5 on macOS
by
zeljko
[
Today
at 10:39:24 pm]
Help with search and repa...
by
Thausand
[
Today
at 08:37:03 pm]
Variable "xyz" doesn't no...
by
Thaddy
[
Today
at 06:53:12 pm]
Incompatible type in MTPr...
by
LemonParty
[
Today
at 06:36:59 pm]
Programmatic filtering in...
by
n7800
[
Today
at 06:34:51 pm]
In fpcsrc, many places ca...
by
AlexTP
[
Today
at 06:15:35 pm]
Postgres, ZEOS and Visual...
by
wp
[
Today
at 05:57:25 pm]
[Solved] Process exited w...
by
d7_2_laz
[
Today
at 05:14:08 pm]
AVRPascal – free code edi...
by
ackarwow
[
Today
at 04:21:44 pm]
Is there a "known good" c...
by
mischi
[
Today
at 02:18:20 pm]
Lazarus Bugfix Release 4...
by
Martin_fr
[
Today
at 12:24:59 pm]
Valgrind stops showing li...
by
Martin_fr
[
Today
at 12:09:06 pm]
Form scaling aspect ratio
by
jamie
[
Today
at 12:07:58 pm]
manufacturing sim (inc)
by
speter
[
Today
at 11:38:56 am]
Can't I highlight part of...
by
Martin_fr
[
Today
at 08:43:03 am]
Mapping Images Like Odome...
by
SandyG
[
Today
at 06:56:55 am]
Access Violation
by
Thaddy
[
Today
at 06:23:59 am]
Problem Installing CHM He...
by
dbannon
[
Today
at 01:53:29 am]
[SOLVED] Heaptrc reports ...
by
jamie
[
Today
at 12:48:49 am]
New book on Object Pascal
by
TBMan
[
Today
at 12:39:00 am]
Fpcupdeluxe
by
Cascade
[November 13, 2025, 10:46:00 pm]
line number when error ha...
by
Martin_fr
[November 13, 2025, 10:37:19 pm]
Unit Masks, matches funct...
by
Martin_fr
[November 13, 2025, 07:31:00 pm]
Minimum and maximum value...
by
ASerge
[November 13, 2025, 07:30:38 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1412 times)
zen010101
Newbie
Posts: 5
How to terminate a THttpAplication?
«
on:
July 17, 2024, 07:54:44 pm »
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]
[+]
[-]
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.
«
Last Edit: July 20, 2024, 07:59:52 pm by zen010101
»
Logged
PascalDragon
Hero Member
Posts: 6195
Compiler Developer
Re: How to terminate a THttpAplication?
«
Reply #1 on:
July 18, 2024, 09:31:03 pm »
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].
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
How to terminate a THttpAplication?
TinyPortal
© 2005-2018