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
Move a window between Wor...
by
MarkMLl
[
Today
at 02:42:39 pm]
How to open Folder and se...
by
paweld
[
Today
at 02:28:48 pm]
Forum is so SLOOOW... Aga...
by
BrunoK
[
Today
at 02:04:43 pm]
DragDrop component from O...
by
domasz
[
Today
at 01:37:49 pm]
Unreliable IDE behaviors
by
backprop
[
Today
at 01:30:57 pm]
The Silver Coder on YouTu...
by
silvercoder70
[
Today
at 01:03:15 pm]
Using Lua 5.4 with Free P...
by
imekon
[
Today
at 12:54:28 pm]
Problems with debugging
by
Martin_fr
[
Today
at 12:52:18 pm]
Lines in Circle Fractal: ...
by
Boleeman
[
Today
at 12:30:15 pm]
the initial method
by
dseligo
[
Today
at 12:17:10 pm]
Rich Text Format componen...
by
dbannon
[
Today
at 11:01:31 am]
I can help to traduce fre...
by
matthius
[
Today
at 09:05:54 am]
In need of a class/compon...
by
Gustavo 'Gus' Carreno
[
Today
at 05:05:57 am]
Regex for changing compon...
by
n7800
[
Today
at 03:05:46 am]
Named range
by
backprop
[
Today
at 01:38:06 am]
Forum upgrade?
by
MarkMLl
[
Today
at 12:51:30 am]
Memory leak in form with ...
by
Wilko500
[September 07, 2024, 11:57:57 pm]
[Solved]Memory Leak and/o...
by
Wilko500
[September 07, 2024, 09:55:05 pm]
Deleting exe-file not wor...
by
JanRoza
[September 07, 2024, 09:28:06 pm]
[Resolved]TTreeView.Expan...
by
jamie
[September 07, 2024, 08:36:55 pm]
[solved] strange behavior...
by
Joanna
[September 07, 2024, 07:05:22 pm]
distinct values from very...
by
Zvoni
[September 07, 2024, 06:55:09 pm]
[SOLVED]Global Path: ther...
by
What I can do
[September 07, 2024, 06:10:42 pm]
Some problems with exampl...
by
wp
[September 07, 2024, 05:51:39 pm]
Memory Leak with CORBA In...
by
janasoft
[September 07, 2024, 05:15:53 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 673 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