[Spice-devel,Xspice,01/11] scripts/Xspice: which: warn if executable is not found

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

Details

Message ID c096f37454332fa897b5a875e0c3a9fb7d09deb9.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 handle None parameter case.
---
 scripts/Xspice |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/Xspice b/scripts/Xspice
index b8a7b78..fee2b0e 100755
--- a/scripts/Xspice
+++ b/scripts/Xspice
@@ -26,12 +26,15 @@  import signal
 from subprocess import Popen, PIPE
 
 def which(x):
+    if not x:
+        return x
     if os.path.exists(x):
         return x
     for p in os.environ['PATH'].split(':'):
         candidate = os.path.join(p, x)
         if os.path.exists(candidate):
             return candidate
+    print 'Warning: failed to find executable %s' % x
     return None
 
 if 'XSPICE_ENABLE_GDB' in os.environ: