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
Conscious Artificial Inte...
by
Dzandaa
[
Today
at 11:50:59 am]
IndySecOpenSSL is now ava...
by
LeP
[
Today
at 11:39:37 am]
Printer Info
by
J-G
[
Today
at 11:26:52 am]
How to monitor changes in...
by
yinhuajian
[
Today
at 11:22:03 am]
Strange Behaviour at Runt...
by
andrew Bubble
[
Today
at 11:19:45 am]
Can I get the position an...
by
CM630
[
Today
at 11:00:33 am]
[New Component] ExtTabCtr...
by
ovidio
[
Today
at 10:36:06 am]
Sizes and SizeInt
by
Thaddy
[
Today
at 09:57:42 am]
Gitlab site history date.
by
Martin_fr
[
Today
at 09:11:14 am]
WEBP, no DLLs
by
CM630
[
Today
at 08:52:43 am]
XLibre, finally and fortu...
by
Thaddy
[
Today
at 08:49:03 am]
Dataset EnableControls/Di...
by
Sharfik
[
Today
at 07:40:21 am]
TVirtualDBTreeEx and upda...
by
Sharfik
[
Today
at 07:36:30 am]
made hooking newinstance ...
by
Thaddy
[
Today
at 06:56:17 am]
Interesting video
by
Curt Carpenter
[
Today
at 04:28:27 am]
how to add a ForEach call...
by
cdbc
[
Today
at 02:19:44 am]
I found an actual use for...
by
jamie
[June 09, 2026, 11:48:04 pm]
Lazarus Main and Gnome/Wa...
by
Jonax
[June 09, 2026, 09:02:10 pm]
MacOS post compilation sc...
by
marcou
[June 09, 2026, 07:30:07 pm]
water filling simulation
by
Dzandaa
[June 09, 2026, 06:53:35 pm]
Pdf Viewer in Pascal
by
Tomxe
[June 09, 2026, 05:00:32 pm]
How can 'Canvas does not ...
by
J-G
[June 09, 2026, 03:05:01 pm]
AArch64. Fast method to c...
by
Thaddy
[June 09, 2026, 01:58:45 pm]
Can /my/ AI help me with ...
by
microxa
[June 09, 2026, 12:12:06 pm]
Knigo
by
CM630
[June 09, 2026, 12:05:31 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1545 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: 6396
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