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
Bright color
by
BubikolRamios
[
Today
at 07:42:07 am]
Benchmarks
by
Thaddy
[
Today
at 07:01:08 am]
compiler messages suggest...
by
440bx
[
Today
at 03:19:38 am]
Common File Dialogs Have ...
by
msintle
[
Today
at 01:03:26 am]
[Solved] pointer to out o...
by
440bx
[
Today
at 12:51:22 am]
storing string
by
ASerge
[December 04, 2024, 11:06:57 pm]
Show Form at Top
by
n7800
[December 04, 2024, 10:16:21 pm]
Arrow keys in FV
by
HotShoe
[December 04, 2024, 10:04:56 pm]
"Active $IFDEF code" is r...
by
MarkMLl
[December 04, 2024, 09:49:15 pm]
NSHapticFeedbackPerformer
by
msintle
[December 04, 2024, 09:47:25 pm]
[SOLVED] Howto use a DEFI...
by
MarkMLl
[December 04, 2024, 09:43:08 pm]
Use tts0, This example is...
by
coradi
[December 04, 2024, 09:37:12 pm]
Library for XSLT 2.0 Tran...
by
ebizz
[December 04, 2024, 06:54:35 pm]
How to know when dragging...
by
Aistis
[December 04, 2024, 06:41:46 pm]
Problem with Hints
by
Handoko
[December 04, 2024, 04:37:21 pm]
Breakpoint dosn't work
by
Martin_fr
[December 04, 2024, 03:55:08 pm]
SetLength fall
by
LemonParty
[December 04, 2024, 03:29:35 pm]
Feature Request for TMapV...
by
EkkehardDomning
[December 04, 2024, 03:23:27 pm]
TLazSerial : serial port ...
by
tetrastes
[December 04, 2024, 02:15:26 pm]
The Silver Coder on YouTu...
by
silvercoder70
[December 04, 2024, 11:45:36 am]
Type Library Viewer, Impo...
by
korba812
[December 04, 2024, 11:39:38 am]
Developing a Kernel Modul...
by
MarkMLl
[December 04, 2024, 11:21:12 am]
C operators and shift
by
Thaddy
[December 04, 2024, 10:45:03 am]
ZDataset.Locate + loParti...
by
tintinux
[December 04, 2024, 09:14:48 am]
Storing line colors
by
Khrys
[December 04, 2024, 07:51:29 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1001 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: 5752
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