summaryrefslogtreecommitdiffstats
path: root/src/session.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-17 16:10:31 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-17 16:10:31 (EST)
commit09c583248e7c0aa5a833ec01262b8b4a7980234b (patch)
treee3ecd4028e888d6eb587d9703ace4d90396a624a /src/session.sh
parentd5e46c35ea98e43b6ad380ac7fbc197b7881b220 (diff)
parente3ab87a78aafd979f6eb8bb75ef70304d87a1d6b (diff)
Merge branch 'feature/improve-error-handling'
Diffstat (limited to 'src/session.sh')
-rw-r--r--src/session.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/session.sh b/src/session.sh
index 6453fae..0728080 100644
--- a/src/session.sh
+++ b/src/session.sh
@@ -43,13 +43,16 @@ session_begin()
[ -d "${session_root}/prokit" ] || mkdir "${session_root}/prokit"
if [ -f "${session_root}/prokit/installing" ] && ! ${installing}; then
- error 2 "$(get_msg 'install_running')"
+ error "$(get_msg 'install_running')"
+ return 1
fi
session_set_sigs
if ! mutex_timedlock "${session_root}/prokit/sessions.lock" 5; then
- error 2 "$(get_msg 'cant_lock_sessions')"
+ error "$(get_msg 'cant_lock_sessions')"
+ trap - ${session_sigs}
+ return 1
fi
# Check for a sessions pool.
@@ -95,7 +98,9 @@ session_end()
if ! mutex_is_unlockable "${session_root}/prokit/sessions.lock"; then
if ! mutex_timedlock "${session_root}/prokit/sessions.lock" 5
then
- error 2 "$(get_msg 'cant_lock_sessions')"
+ error "$(get_msg 'cant_lock_sessions')"
+ trap - ${session_sigs}
+ return 1
fi
fi