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
Inversive Geometry Curves...
by
Boleeman
[
Today
at 08:06:00 am]
ZUGFeRD: Which PDF lib to...
by
cdbc
[
Today
at 08:03:31 am]
SQLite3 Date Problem
by
cdbc
[
Today
at 07:58:03 am]
Map vs dataset
by
cdbc
[
Today
at 07:46:53 am]
TTrayIcon do not work pro...
by
Thaddy
[
Today
at 07:36:19 am]
Undefined symbol: WSRegis...
by
ljz111
[
Today
at 07:19:58 am]
Arrow keys in FV
by
Thaddy
[
Today
at 06:33:08 am]
[SOLVED] How much would i...
by
egsuh
[
Today
at 06:15:02 am]
kernel 6.8 and checking s...
by
robert rozee
[
Today
at 05:31:18 am]
storing string
by
Wesbat
[
Today
at 04:51:11 am]
How to know when dragging...
by
jamie
[
Today
at 02:30:22 am]
Breakpoint dosn't work
by
Martin_fr
[
Today
at 12:43:37 am]
[SOLVED] Howto use a DEFI...
by
bytebites
[
Today
at 12:05:01 am]
Common File Dialogs Have ...
by
msintle
[
Today
at 12:04:48 am]
C operators and shift
by
Warfley
[December 05, 2024, 11:19:19 pm]
Tmemo add char like typin...
by
ackarwow
[December 05, 2024, 10:47:59 pm]
Python4Lazarus Undefined ...
by
AlexTP
[December 05, 2024, 08:42:33 pm]
mxMarkEdit, a new visual ...
by
maxnd
[December 05, 2024, 06:08:17 pm]
Api/component pack for Ra...
by
MarkMLl
[December 05, 2024, 04:47:33 pm]
compiler messages suggest...
by
Thaddy
[December 05, 2024, 04:15:17 pm]
Wrong resolution of secon...
by
Apiglio
[December 05, 2024, 03:13:47 pm]
Benchmarks
by
Warfley
[December 05, 2024, 02:00:39 pm]
[Solved]I have created dl...
by
Packs
[December 05, 2024, 01:11:27 pm]
TLazSerial : serial port ...
by
tetrastes
[December 05, 2024, 12:26:29 pm]
Bright color
by
Warfley
[December 05, 2024, 10:29:06 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1006 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: 5755
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