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
Warning on identifier usa...
by
marcov
[
Today
at 09:42:49 am]
link error on Ubuntu 22.0...
by
Thaddy
[
Today
at 09:02:12 am]
Lazarus Release Candidate...
by
jonyrh
[
Today
at 05:51:01 am]
How to Run Lazarus App wi...
by
incendio
[
Today
at 04:59:33 am]
Weird error: component no...
by
heebiejeebies
[
Today
at 04:09:03 am]
ADUG Symposium 2025 is on
by
Mathias Burbach
[
Today
at 02:10:05 am]
Rest API chunk file downl...
by
Leledumbo
[
Today
at 01:01:56 am]
DateUtils *Span and *Betw...
by
Thaddy
[March 25, 2025, 11:07:30 pm]
Converting a Project from...
by
1HuntnMan
[March 25, 2025, 10:37:34 pm]
CPU-View
by
Martin_fr
[March 25, 2025, 08:49:41 pm]
/lib/x86_64-linux-gnu/lib...
by
TRon
[March 25, 2025, 08:26:08 pm]
Mixing LazMapViewer and O...
by
MarkMLl
[March 25, 2025, 07:45:53 pm]
GTK3 still alpha
by
Thaddy
[March 25, 2025, 07:16:14 pm]
Fast Fourier Transform (F...
by
VTwin
[March 25, 2025, 04:51:12 pm]
SIMD QuickSort
by
mikerabat
[March 25, 2025, 01:57:44 pm]
[SOLVED] suddenly i have ...
by
CharlyTango
[March 25, 2025, 11:29:56 am]
Problems with Lazaruz 3.8...
by
salvadordf
[March 25, 2025, 11:22:35 am]
"database not open" - IBX...
by
CharlyTango
[March 25, 2025, 11:20:22 am]
Very Slow Online Package ...
by
Marc
[March 25, 2025, 09:52:13 am]
Velthuis.Console.pas - Wo...
by
Thaddy
[March 25, 2025, 08:55:31 am]
No fpc found on a fresh i...
by
Thaddy
[March 25, 2025, 08:30:15 am]
Lazarus is not working
by
Thaddy
[March 25, 2025, 08:18:33 am]
Peano Fractals: Rainbow t...
by
Boleeman
[March 25, 2025, 07:19:37 am]
Drive a tank around the s...
by
Boleeman
[March 25, 2025, 06:22:40 am]
DuckHunter Game
by
TRon
[March 25, 2025, 04:19:56 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1187 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: 5909
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