Kaydet (Commit) 175001db authored tarafından Neal Norwitz's avatar Neal Norwitz

If the executable doesn't exist, there's no reason to try to start it.

This prevents garbage about command not found being printed on Solaris.
üst abd51a35
......@@ -274,10 +274,13 @@ class UUID(object):
def _find_mac(command, args, hw_identifiers, get_index):
import os
for dir in ['', '/sbin/', '/usr/sbin']:
executable = os.path.join(dir, command)
if not os.path.exists(executable):
continue
try:
# LC_ALL to get English output, 2>/dev/null to
# prevent output on stderr
executable = os.path.join(dir, command)
cmd = 'LC_ALL=C %s %s 2>/dev/null' % (executable, args)
pipe = os.popen(cmd)
except IOError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment