forked from drath/libratbag
tools: print a nice error when we don't have the required capabilities
Fixes #583 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Benjamin Tissoires
parent
1586913fc7
commit
16e052d846
@@ -30,6 +30,7 @@ import time
|
||||
import toolbox
|
||||
import signal
|
||||
import sys
|
||||
from ratbagctl import RatbagErrorCapability # NOQA
|
||||
|
||||
|
||||
def main(argv):
|
||||
@@ -64,10 +65,13 @@ def main(argv):
|
||||
parser.print_help()
|
||||
return
|
||||
else:
|
||||
f(ratbagd, cmd)
|
||||
# give time for ratbagd to receive async requests before
|
||||
# we try to terminate it
|
||||
time.sleep(0.5)
|
||||
try:
|
||||
f(ratbagd, cmd)
|
||||
# give time for ratbagd to receive async requests before
|
||||
# we try to terminate it
|
||||
time.sleep(0.5)
|
||||
except RatbagErrorCapability as e:
|
||||
print("Error: {}".format(e), file=sys.stderr)
|
||||
finally:
|
||||
try:
|
||||
if cmd.keepalive:
|
||||
|
||||
@@ -1562,7 +1562,10 @@ def main(argv):
|
||||
parser.print_help()
|
||||
return
|
||||
else:
|
||||
f(r, cmd)
|
||||
try:
|
||||
f(r, cmd)
|
||||
except RatbagErrorCapability as e:
|
||||
print("Error: {}".format(e), file=sys.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user