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
Fpcupdeluxe
by
Thausand
[
Today
at 06:48:17 pm]
Problem Installing CHM He...
by
marcov
[
Today
at 05:03:32 pm]
Bindings for PlutoVG
by
CynicRus
[
Today
at 04:49:28 pm]
Lazarus Bugfix Release 4...
by
Martin_fr
[
Today
at 04:48:44 pm]
Lazarus 4.4 documentation...
by
dsiders
[
Today
at 04:13:58 pm]
AArch64. Slow program sta...
by
Thaddy
[
Today
at 04:00:35 pm]
Creating a fully cross pl...
by
Thaddy
[
Today
at 03:51:55 pm]
UnoLib - library in Pasca...
by
ackarwow
[
Today
at 01:06:58 pm]
Help with search and repa...
by
Zvoni
[
Today
at 12:35:12 pm]
Lazarus caught AV, seems ...
by
Martin_fr
[
Today
at 12:20:47 pm]
Porting PDF Viewer from D...
by
domasz
[
Today
at 11:31:03 am]
Anyone interested in help...
by
ad1mt
[
Today
at 11:07:12 am]
Feature request: Default ...
by
Hansaplast
[
Today
at 10:00:51 am]
Getting a true variant pa...
by
440bx
[
Today
at 09:05:26 am]
application crashes on st...
by
Thaddy
[
Today
at 08:30:33 am]
synedit
by
scasparz
[
Today
at 08:21:38 am]
BGRA Themes - Themed cont...
by
Froxter
[
Today
at 08:21:20 am]
Initialize list in functi...
by
PeterHu
[
Today
at 06:44:38 am]
FPC v3.2.2 internal error
by
PascalDragon
[November 10, 2025, 09:52:00 pm]
FPC 3.2.4-rc1 available
by
JdeHaan
[November 10, 2025, 09:40:36 pm]
How to implement uKey-bas...
by
delphius
[November 10, 2025, 09:25:12 pm]
[SOLVED] Heaptrc reports ...
by
Bart
[November 10, 2025, 07:06:57 pm]
Lazarus Blowfish
by
rvk
[November 10, 2025, 05:17:17 pm]
An Idea for a helpful uti...
by
Curt Carpenter
[November 10, 2025, 04:33:20 pm]
Info for PTCGraph users.....
by
Handoko
[November 10, 2025, 04:01:45 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1410 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: 6191
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