Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladimir Barsukov
zGo
Commits
b9d319f8
Commit
b9d319f8
authored
Nov 18, 2023
by
Vladimir Barsukov
Browse files
fix
parent
14e3a3b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
zquit/zquit.go
View file @
b9d319f8
...
@@ -47,7 +47,9 @@ func (q *ZQuit) Val() int {
...
@@ -47,7 +47,9 @@ func (q *ZQuit) Val() int {
}
}
func
(
q
*
ZQuit
)
WaitInterruptPrePost
(
pre
func
(),
post
func
())
{
func
(
q
*
ZQuit
)
WaitInterruptPrePost
(
pre
func
(),
post
func
())
{
pre
()
if
pre
!=
nil
{
pre
()
}
c
:=
make
(
chan
os
.
Signal
,
1
)
c
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
c
,
os
.
Interrupt
,
syscall
.
SIGTERM
)
signal
.
Notify
(
c
,
os
.
Interrupt
,
syscall
.
SIGTERM
)
...
@@ -56,11 +58,13 @@ func (q *ZQuit) WaitInterruptPrePost(pre func(), post func()) {
...
@@ -56,11 +58,13 @@ func (q *ZQuit) WaitInterruptPrePost(pre func(), post func()) {
q
.
Wait
()
q
.
Wait
()
post
()
if
post
!=
nil
{
post
()
}
}
}
func
(
q
*
ZQuit
)
WaitInterrupt
()
{
func
(
q
*
ZQuit
)
WaitInterrupt
()
{
q
.
WaitInterruptPrePost
(
func
()
{},
func
()
{}
)
q
.
WaitInterruptPrePost
(
nil
,
nil
)
}
}
func
(
q
*
ZQuit
)
Middleware
(
c
*
gin
.
Context
)
{
func
(
q
*
ZQuit
)
Middleware
(
c
*
gin
.
Context
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment