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
Recursive Circles Type Fr...
by
Boleeman
[
Today
at 10:08:38 am]
Access MSSQL with Lazarus
by
luca
[
Today
at 09:55:00 am]
order of evaluation of ov...
by
MarkMLl
[
Today
at 09:52:28 am]
What's wrong with TListBo...
by
dsiders
[
Today
at 09:49:50 am]
Why renaming must be done...
by
Thaddy
[
Today
at 09:06:16 am]
Little Red Riding Hood (t...
by
circular
[
Today
at 08:46:13 am]
Bitmap 16bit R5G6B5
by
circular
[
Today
at 08:43:34 am]
Cannot rebuild Lazarus af...
by
PierceNg
[
Today
at 03:44:47 am]
lazarus ide tstring list ...
by
Prakash
[
Today
at 03:21:50 am]
Toggle Form/Unit View by ...
by
Aruna
[
Today
at 02:21:42 am]
Dash documentation for La...
by
dbannon
[
Today
at 02:16:46 am]
[Solved] Rich Text Format...
by
dbannon
[
Today
at 02:04:29 am]
LazTTF2Vector - An Enhanc...
by
maurog
[
Today
at 12:49:07 am]
[SOLVED] Copy the content...
by
PascalDragon
[September 19, 2024, 09:48:10 pm]
Trying to show compile ti...
by
QEnnay
[September 19, 2024, 09:38:24 pm]
Compiler error when check...
by
PascalDragon
[September 19, 2024, 09:37:17 pm]
Office Automation (MSWORD...
by
totya
[September 19, 2024, 09:29:35 pm]
Str declaration
by
PascalDragon
[September 19, 2024, 09:29:14 pm]
How can I get help in the...
by
vfclists
[September 19, 2024, 09:26:16 pm]
[SOLVED] DBGRID | Picklis...
by
bourbon
[September 19, 2024, 08:49:29 pm]
TListView.OnChange Event ...
by
msintle
[September 19, 2024, 07:19:54 pm]
[SOLVED] LazReport / Free...
by
1HuntnMan
[September 19, 2024, 06:55:33 pm]
Themed checkboxes for Tre...
by
apeoperaio
[September 19, 2024, 06:35:29 pm]
Quick questions
by
MarkMLl
[September 19, 2024, 06:24:39 pm]
LazCAD – First Release!
by
maurog
[September 19, 2024, 06:09:01 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 883 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: 5654
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