mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-10 07:36:28 -04:00
cleanup is part of the external interface
Since there's no EXIT trap in plain sh, the main script must call it explicitly when it exits. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
93aaf2e998
commit
d9b3209f51
@ -101,15 +101,18 @@ EOF
|
|||||||
## The file names must not contain whitespace characters.
|
## The file names must not contain whitespace characters.
|
||||||
files_to_clean=
|
files_to_clean=
|
||||||
|
|
||||||
|
## Call this function at the end of each script.
|
||||||
|
## It is called automatically if the script is killed by a signal.
|
||||||
|
cleanup () {
|
||||||
|
rm -f -- $files_to_clean
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
## End of the public interfaces. Code beyond this point is not
|
## End of the public interfaces. Code beyond this point is not
|
||||||
## meant to be called directly from a demo script.
|
## meant to be called directly from a demo script.
|
||||||
|
|
||||||
cleanup () {
|
|
||||||
rm -f -- $files_to_clean
|
|
||||||
}
|
|
||||||
trap 'cleanup; trap - HUP; kill -HUP $$' HUP
|
trap 'cleanup; trap - HUP; kill -HUP $$' HUP
|
||||||
trap 'cleanup; trap - INT; kill -INT $$' INT
|
trap 'cleanup; trap - INT; kill -INT $$' INT
|
||||||
trap 'cleanup; trap - TERM; kill -TERM $$' TERM
|
trap 'cleanup; trap - TERM; kill -TERM $$' TERM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user