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
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
UI app to work with SQLit...
by
Tomu
[
Today
at 11:53:42 pm]
Elite Arcade
by
Guva
[
Today
at 11:25:29 pm]
Freepascal
by
marcelomaurinmartins@gmai
[
Today
at 11:24:44 pm]
International Pascal Cong...
by
vincococka
[
Today
at 11:18:49 pm]
Printing on HP Smart Tank
by
JerryHudson
[
Today
at 10:22:12 pm]
Help needed on how to do ...
by
cdbc
[
Today
at 08:38:38 pm]
TDateTimePicker - Make th...
by
wp
[
Today
at 08:20:10 pm]
TCollection wiki entry
by
korba812
[
Today
at 08:18:03 pm]
Why is my program freezin...
by
paweld
[
Today
at 07:19:46 pm]
is there PDS reader/expor...
by
jamie
[
Today
at 07:01:12 pm]
Fpcupdeluxe
by
cdbc
[
Today
at 06:40:29 pm]
weird error message
by
jamie
[
Today
at 06:37:01 pm]
Como compilar uma lib par...
by
marcelomaurinmartins@gmai
[
Today
at 06:24:51 pm]
Desenvolvimento visual pa...
by
marcelomaurinmartins@gmai
[
Today
at 06:19:16 pm]
OpenDocument('Filename') ...
by
J-G
[
Today
at 06:13:03 pm]
TTL Record Count, i.e. a ...
by
1HuntnMan
[
Today
at 06:05:29 pm]
Using callback
by
LemonParty
[
Today
at 05:43:15 pm]
equivalent to C/C++ "offs...
by
jamie
[
Today
at 12:58:11 pm]
Source Editor Collapsed P...
by
J-G
[
Today
at 11:17:14 am]
Habari STOMP Clients for ...
by
mjustin
[
Today
at 11:15:54 am]
Questions on slight diffe...
by
egsuh
[
Today
at 09:45:30 am]
Have anybody used Horse f...
by
egsuh
[
Today
at 08:31:21 am]
Problems with creating a ...
by
jamie
[
Today
at 12:10:44 am]
val return code
by
Paolo
[July 10, 2026, 10:58:32 pm]
Gtk3 becomes default widg...
by
PascalDragon
[July 10, 2026, 09:59:25 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to terminate a THttpAplication? (Read 1557 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: 6403
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