1
0
forked from drath/libratbag

tools: don't return a ratbagd_process if things failed

If we couldn't find the name on the bus or the ratbagd process already
terminated, return None and fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-08-23 11:32:35 +10:00
committed by Benjamin Tissoires
parent 572f00cf2a
commit 9f805a4ebe
2 changed files with 5 additions and 0 deletions

View File

@@ -39,6 +39,8 @@ def main(argv):
argv = ["list"]
ratbagd_process = toolbox.start_ratbagd()
if ratbagd_process is None:
sys.exit("Failed to start or connect to ratbagd")
ratbagd = toolbox.open_ratbagd()
parser = toolbox.get_parser()

View File

@@ -84,6 +84,9 @@ def start_ratbagd():
os.environ['RATBAGCTL_DEVEL'] = "org.freedesktop.ratbag_devel1_@ratbagd_sha@"
if name_owner is None or ratbagd_process.poll() is not None:
return None
return ratbagd_process