Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (20 sloc) 717 Bytes
# adapted from
import os.path
import subprocess
class BinaryNotFoundError(Exception):
def find_binary(name):
dirs = ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin',
'/sbin', '/bin']
for dir in dirs:
path = os.path.join(dir, name)
if os.path.exists(path):
return path
raise BinaryNotFoundError('The binary ' + name + ' could not be ' + \
def execute(args):
proc = subprocess.Popen(args, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output =
return output
Something went wrong with that request. Please try again.