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
Lazarus broke my project
by
jamie
[
Today
at 04:25:12 pm]
Lowercase Drive in LAZ 4....
by
Adie
[
Today
at 04:23:56 pm]
Store directories and fil...
by
jamie
[
Today
at 03:44:08 pm]
Amigo programming languag...
by
paxscript
[
Today
at 02:35:23 pm]
Some testing the water qu...
by
mdlueck
[
Today
at 02:17:55 pm]
New Mac mini M4 - FPC 3.2...
by
Thaddy
[
Today
at 12:43:42 pm]
SandTris (Tetris variant)
by
Thaddy
[
Today
at 12:16:27 pm]
EditorMacroScript did not...
by
jamie
[
Today
at 12:11:50 pm]
Fpcupdeluxe
by
DonAlfredo
[
Today
at 10:39:15 am]
Get "serial number" of (r...
by
Thaddy
[
Today
at 09:25:53 am]
WaveFunction Collapse
by
Boleeman
[
Today
at 04:11:50 am]
Free Vision Build Failing...
by
swissbob
[November 15, 2025, 11:54:34 pm]
Add new unit to a Lazarus...
by
n7800
[November 15, 2025, 11:50:01 pm]
Programmatic filtering in...
by
jamie
[November 15, 2025, 08:05:46 pm]
How to hide IEEE754 limit...
by
srvaldez
[November 15, 2025, 07:42:38 pm]
This worries me about our...
by
Curt Carpenter
[November 15, 2025, 06:32:55 pm]
Porting PDF Viewer from D...
by
Boleeman
[November 15, 2025, 06:21:52 pm]
Form scaling aspect ratio
by
jamie
[November 15, 2025, 05:01:41 pm]
Demo #3 of my "home grown...
by
TBMan
[November 15, 2025, 03:05:57 pm]
Seems like good timing to...
by
mdlueck
[November 15, 2025, 02:17:23 pm]
Lazarus Bugfix Release 4...
by
jwdietrich
[November 15, 2025, 01:54:34 pm]
synedit
by
Martin_fr
[November 15, 2025, 01:49:12 pm]
[SOLVED] How to update 'F...
by
Hartmut
[November 15, 2025, 01:33:36 pm]
Help with search and repa...
by
avk
[November 15, 2025, 07:09:59 am]
Variable "xyz" doesn't no...
by
Mr.Madguy
[November 15, 2025, 06:22:15 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1414 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