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 toolbox
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
from ratbagctl import RatbagErrorCapability # NOQA
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
@@ -64,10 +65,13 @@ def main(argv):
|
|||||||
parser.print_help()
|
parser.print_help()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
f(ratbagd, cmd)
|
try:
|
||||||
# give time for ratbagd to receive async requests before
|
f(ratbagd, cmd)
|
||||||
# we try to terminate it
|
# give time for ratbagd to receive async requests before
|
||||||
time.sleep(0.5)
|
# we try to terminate it
|
||||||
|
time.sleep(0.5)
|
||||||
|
except RatbagErrorCapability as e:
|
||||||
|
print("Error: {}".format(e), file=sys.stderr)
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
if cmd.keepalive:
|
if cmd.keepalive:
|
||||||
|
|||||||
@@ -1562,7 +1562,10 @@ def main(argv):
|
|||||||
parser.print_help()
|
parser.print_help()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
f(r, cmd)
|
try:
|
||||||
|
f(r, cmd)
|
||||||
|
except RatbagErrorCapability as e:
|
||||||
|
print("Error: {}".format(e), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user