Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
devtools
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
archlinux
devtools
Commits
7228cc00
Commit
7228cc00
authored
12 years ago
by
Pierre Schmitz
Browse files
Options
Downloads
Patches
Plain Diff
Use dedicated trap functions to avoid unsetting the trap when e.g. cleanup is called
parent
a26416dc
No related branches found
Branches containing commit
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/common.sh
+12
-4
12 additions, 4 deletions
lib/common.sh
with
12 additions
and
4 deletions
lib/common.sh
+
12
−
4
View file @
7228cc00
...
...
@@ -62,8 +62,6 @@ setup_workdir() {
}
cleanup
()
{
trap
- EXIT INT QUIT TERM HUP
[[
-n
$WORKDIR
]]
&&
rm
-rf
"
$WORKDIR
"
[[
$1
]]
&&
exit
$1
}
...
...
@@ -73,13 +71,23 @@ abort() {
cleanup 0
}
trap_abort
()
{
trap
- EXIT INT QUIT TERM HUP
abort
}
trap_exit
()
{
trap
- EXIT INT QUIT TERM HUP
cleanup 0
}
die
()
{
error
"
$*
"
cleanup 1
}
trap
abort INT QUIT TERM HUP
trap
'
cleanup 0
'
EXIT
trap
'trap_
abort
'
INT QUIT TERM HUP
trap
'
trap_exit
'
EXIT
##
# usage : in_array( $needle, $haystack )
...
...
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