forked from UsergeTeam/Userge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix not properly terminates the processes
- Loading branch information
Showing
6 changed files
with
84 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. | ||
# | ||
# This file is part of < https://github.com/UsergeTeam/Userge > project, | ||
# and is released under the "GNU v3.0 License Agreement". | ||
# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > | ||
# | ||
# All rights reserved. | ||
|
||
declare -i bgProc | ||
|
||
_addHandler() { | ||
trap killProc HUP TERM INT | ||
} | ||
|
||
_removeHandler() { | ||
trap - HUP TERM INT | ||
} | ||
|
||
setProc() { | ||
bgProc=$1 | ||
} | ||
|
||
_waitProc() { | ||
test $bgProc && wait $bgProc | ||
} | ||
|
||
waitProc() { | ||
_waitProc | ||
_removeHandler | ||
_waitProc | ||
} | ||
|
||
killProc() { | ||
test $bgProc && kill -TERM $bgProc &> /dev/null | ||
} | ||
|
||
reInitProc() { | ||
killProc | ||
waitProc | ||
_addHandler | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters