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
Tone Generator
by
Gigatron
[
Today
at 10:41:46 pm]
Icon file was loaded on m...
by
AlexTP
[
Today
at 10:40:45 pm]
Why does this happen
by
Bart
[
Today
at 10:31:02 pm]
crtbeginS.o and crtendS.o...
by
munair
[
Today
at 10:18:46 pm]
Error trying to initializ...
by
Fibonacci
[
Today
at 10:13:29 pm]
Inconsistent function des...
by
440bx
[
Today
at 09:26:07 pm]
Acessing a file dialog fr...
by
tfurnivall
[
Today
at 09:23:44 pm]
Learn how to (un)dock a T...
by
Hansvb
[
Today
at 07:42:28 pm]
Recortar (trim) archivo d...
by
FelizKatus
[
Today
at 05:57:45 pm]
IDE locks the work if pro...
by
AlexTP
[
Today
at 04:25:33 pm]
Rotating 3D Supershape (S...
by
Boleeman
[
Today
at 04:13:04 pm]
BGRA Controls
by
mizar
[
Today
at 03:35:45 pm]
ProjectTemplates - Copy s...
by
paweld
[
Today
at 02:41:28 pm]
Lazbarcode 3of9 - half ba...
by
Int3g3r
[
Today
at 02:23:41 pm]
I can write your README.m...
by
Fred vS
[
Today
at 01:49:21 pm]
Periodic Table
by
VisualLab
[
Today
at 01:38:19 pm]
Trim audio file
by
FelizKatus
[
Today
at 01:25:36 pm]
InstallAware 2025 Sources...
by
msintle
[
Today
at 01:01:28 pm]
Negative offset
by
LemonParty
[
Today
at 12:58:11 pm]
[SOLVED] How to "Jump To"...
by
dbannon
[
Today
at 12:55:28 pm]
FPC 3.2.2 + GDB
by
marcov
[
Today
at 11:27:41 am]
Compiler raised internal ...
by
TYDQ
[
Today
at 03:27:23 am]
Problema ao Instalar BGRA...
by
Fred vS
[May 18, 2025, 11:46:48 pm]
External ACCESS VIOLATION...
by
alpine
[May 18, 2025, 11:30:10 pm]
PascalScada installing
by
jamie
[May 18, 2025, 10:24:44 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1240 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: 5968
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