[Spice-devel,Xspice,02/11] scripts/Xspice: better error messages for missing vdagent binaries

Submitted by Uri Lublin on Jan. 26, 2015, 10:35 a.m.

Details

Message ID e0db34c29c12501bb62eccb66de1cbe0ea0067bd.1422267879.git.uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin Jan. 26, 2015, 10:35 a.m.
Also added a check for the case variables are uninitialized (or
when the executables are not found and which returns None)
---
 scripts/Xspice |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/Xspice b/scripts/Xspice
index fee2b0e..d48318c 100755
--- a/scripts/Xspice
+++ b/scripts/Xspice
@@ -114,8 +114,14 @@  if cgdb:
 args, xorg_args = parser.parse_known_args(sys.argv[1:])
 
 def agents_new_enough(args):
-    if not os.path.exists(args.vdagent_exec) or not os.path.exists(args.vdagentd_exec):
-        return False
+    for f in [args.vdagent_exec, args.vdagentd_exec]:
+        if not f:
+            print 'please specify path to vdagent/vdagentd executables'
+            return False
+        if not os.path.exists(f):
+            print 'error: file not found ', f
+            return False
+
     for f in [args.vdagent_exec, args.vdagentd_exec]:
         if Popen(args=[f, '-h'], stdout=PIPE).stdout.read().find('-S') == -1:
             return False