mirror of
https://github.com/python/cpython.git
synced 2025-09-16 21:56:14 +00:00
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.
This commit is contained in:
parent
abd51a3585
commit
175001db9e
1 changed files with 4 additions and 1 deletions
|
@ -274,10 +274,13 @@ class UUID(object):
|
||||||
def _find_mac(command, args, hw_identifiers, get_index):
|
def _find_mac(command, args, hw_identifiers, get_index):
|
||||||
import os
|
import os
|
||||||
for dir in ['', '/sbin/', '/usr/sbin']:
|
for dir in ['', '/sbin/', '/usr/sbin']:
|
||||||
|
executable = os.path.join(dir, command)
|
||||||
|
if not os.path.exists(executable):
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# LC_ALL to get English output, 2>/dev/null to
|
# LC_ALL to get English output, 2>/dev/null to
|
||||||
# prevent output on stderr
|
# prevent output on stderr
|
||||||
executable = os.path.join(dir, command)
|
|
||||||
cmd = 'LC_ALL=C %s %s 2>/dev/null' % (executable, args)
|
cmd = 'LC_ALL=C %s %s 2>/dev/null' % (executable, args)
|
||||||
pipe = os.popen(cmd)
|
pipe = os.popen(cmd)
|
||||||
except IOError:
|
except IOError:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue