mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-29 07:04:20 +00:00
Fix try_exec failure detection
This commit is contained in:
parent
0de4032a41
commit
5b2e202b4f
@ -245,16 +245,18 @@ try_exec() {
|
|||||||
if [ -x "$(command -v pkexec)" ]; then
|
if [ -x "$(command -v pkexec)" ]; then
|
||||||
pkexec sh -c "$1"
|
pkexec sh -c "$1"
|
||||||
|
|
||||||
# Check the return value
|
# Check the exit status
|
||||||
if [ "$?" -eq 126 ] || [ "$?" -eq 127 ]; then
|
statuscode="$?"
|
||||||
|
if [ "$statuscode" -eq 126 ] || [ "$statuscode" -eq 127 ]; then
|
||||||
# User cancel or error
|
# User cancel or error
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sudo sh -c "$1"
|
sudo sh -c "$1"
|
||||||
|
|
||||||
# Check the return value
|
# Check the exit status
|
||||||
if [ "$?" -eq 1 ]; then
|
statuscode="$?"
|
||||||
|
if [ "$statuscode" -eq 1 ] || [ "$statuscode" -eq 127 ]; then
|
||||||
# Error
|
# Error
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user