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
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
LazCAD – First Release!
by
wp
[
Today
at 10:08:24 pm]
Unable install latest fpc...
by
JohnnieK
[
Today
at 09:57:12 pm]
Extended Module Player
by
Gigatron
[
Today
at 09:11:48 pm]
IDE odd behaviour
by
Martin_fr
[
Today
at 09:08:17 pm]
How to disable the compat...
by
Jonas Maebe
[
Today
at 08:59:30 pm]
Problem with pasting text...
by
LV
[
Today
at 08:46:58 pm]
How to create webhook in ...
by
Prakash
[
Today
at 07:59:41 pm]
New Component jZCamView
by
Guser979
[
Today
at 07:49:22 pm]
Forum upgrade?
by
MarkMLl
[
Today
at 07:47:00 pm]
Is there a maximum length...
by
Remy Lebeau
[
Today
at 07:35:30 pm]
PATCH method in fphttpcli...
by
JohnnieK
[
Today
at 05:57:38 pm]
THTTPRouter Documentation
by
JohnnieK
[
Today
at 05:54:48 pm]
TryStrToFloat
by
jcmontherock
[
Today
at 05:25:30 pm]
My first Attempt making a...
by
jamie
[
Today
at 04:10:52 pm]
Having difficulty buidlin...
by
MarkMLl
[
Today
at 03:49:23 pm]
Move a window between Wor...
by
dbannon
[
Today
at 02:05:28 pm]
Loosing mouse clicks when...
by
Wilko500
[
Today
at 12:51:41 pm]
TStateMachine
by
matthius
[
Today
at 12:51:16 pm]
Forum is so SLOOOW... Aga...
by
Marc
[
Today
at 12:29:35 pm]
[SOLVED] Need help to use...
by
marcov
[
Today
at 10:13:45 am]
AI, NLP and CAI: Text Gen...
by
schuler
[
Today
at 06:24:11 am]
Advice/Guidance Needed Wi...
by
Aruna
[
Today
at 06:05:58 am]
Using Lua 5.4 with Free P...
by
Roland57
[
Today
at 05:14:59 am]
How to open Folder and se...
by
Remy Lebeau
[
Today
at 01:57:02 am]
the initial method
by
Remy Lebeau
[
Today
at 01:44:56 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 713 times)
zen010101
Newbie
Posts: 4
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: 5644
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