Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qbar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
qbar
Commits
309f3078
Commit
309f3078
authored
5 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Remove broken SIGTERM handler
parent
681a8ad3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/QBar/Host.hs
+4
-17
4 additions, 17 deletions
src/QBar/Host.hs
with
4 additions
and
17 deletions
src/QBar/Host.hs
+
4
−
17
View file @
309f3078
...
@@ -7,7 +7,7 @@ import QBar.BlockOutput
...
@@ -7,7 +7,7 @@ import QBar.BlockOutput
import
QBar.Core
import
QBar.Core
import
QBar.Time
import
QBar.Time
import
Control.Concurrent
(
ThreadId
,
forkIO
,
forkFinally
,
threadDelay
,
myThreadId
,
throwTo
)
import
Control.Concurrent
(
forkIO
,
forkFinally
,
threadDelay
)
import
Control.Concurrent.Async
(
async
,
wait
)
import
Control.Concurrent.Async
(
async
,
wait
)
import
qualified
Control.Concurrent.Event
as
Event
import
qualified
Control.Concurrent.Event
as
Event
import
Control.Concurrent.MVar
(
MVar
,
newMVar
,
modifyMVar_
,
swapMVar
)
import
Control.Concurrent.MVar
(
MVar
,
newMVar
,
modifyMVar_
,
swapMVar
)
...
@@ -19,11 +19,9 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
...
@@ -19,11 +19,9 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
import
Data.Maybe
(
catMaybes
,
mapMaybe
)
import
Data.Maybe
(
catMaybes
,
mapMaybe
)
import
qualified
Data.Text.Lazy
as
T
import
qualified
Data.Text.Lazy
as
T
import
Pipes
import
Pipes
import
System.Exit
import
System.IO
(
stderr
,
hPutStrLn
)
import
System.IO
(
stderr
,
hPutStrLn
)
import
System.Posix.Process
(
createSession
)
import
System.Posix.Signals
(
Handler
(
..
),
sigCONT
,
installHandler
)
import
System.Posix.Signals
(
Handler
(
..
),
sigTERM
,
sigCONT
,
signalProcessGroup
,
installHandler
)
import
System.Posix.Types
(
ProcessGroupID
)
data
HostHandle
=
HostHandle
{
data
HostHandle
=
HostHandle
{
barUpdateEvent
::
BarUpdateEvent
,
barUpdateEvent
::
BarUpdateEvent
,
...
@@ -34,23 +32,12 @@ data HostHandle = HostHandle {
...
@@ -34,23 +32,12 @@ data HostHandle = HostHandle {
}
}
installSignalHandlers
::
Bar
->
IO
()
installSignalHandlers
::
Bar
->
IO
()
installSignalHandlers
bar
=
do
installSignalHandlers
bar
=
void
$
installHandler
sigCONT
(
Catch
sigContAction
)
Nothing
mainThread
<-
myThreadId
processGroup
<-
createSession
void
$
installHandler
sigCONT
(
Catch
sigContAction
)
Nothing
void
$
installHandler
sigTERM
(
Catch
$
sigTermAction
mainThread
processGroup
)
Nothing
where
where
sigContAction
::
IO
()
sigContAction
::
IO
()
sigContAction
=
do
sigContAction
=
do
hPutStrLn
stderr
"SIGCONT received"
hPutStrLn
stderr
"SIGCONT received"
updateBarDefault'
bar
updateBarDefault'
bar
sigTermAction
::
ThreadId
->
ProcessGroupID
->
IO
()
sigTermAction
mainThread
processGroup
=
do
void
$
installHandler
sigTERM
Ignore
Nothing
hPutStrLn
stderr
"SIGTERM received"
hPutStrLn
stderr
"Killing process group"
signalProcessGroup
sigTERM
processGroup
throwTo
mainThread
$
ExitFailure
143
eventDispatcher
::
Bar
->
IORef
[(
T
.
Text
,
BlockEventHandler
)]
->
Consumer
BlockEvent
IO
()
eventDispatcher
::
Bar
->
IORef
[(
T
.
Text
,
BlockEventHandler
)]
->
Consumer
BlockEvent
IO
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment