Ejemplo n.º 1
0
def call(command):
	try:
		output = proc_call(command)
	except CalledProcessError as e:
		output = e.output
	if output:
		print('Executing','"%s":' % ' '.join(command))
		for line in output.splitlines():
			print(' ',line.decode())
Ejemplo n.º 2
0
def call(command):
    try:
        output = proc_call(command)
    except CalledProcessError as e:
        output = e.output
    if output:
        print('Executing', '"%s":' % ' '.join(command))
        for line in output.splitlines():
            print(' ', line.decode())
Ejemplo n.º 3
0
def call_subprocess(cmd, **kw):
    try:
        from subprocess import proc_call
    except ImportError:
        # no subprocess for Python 2.3
        def proc_call(cmd, **kwargs):
            cwd = kwargs.get('cwd', '.')
            old_cwd = os.getcwd()
            try:
                os.chdir(cwd)
                return os.system(' '.join(cmd))
            finally:
                os.chdir(old_cwd)

    cwd = kw.get('cwd', '.')
    cmd_desc = ' '.join(cmd)
    log.info('Running "%s" in %s' % (cmd_desc, cwd))
    returncode = proc_call(cmd, **kw)
    if returncode:
        raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Ejemplo n.º 4
0
def call_subprocess(cmd, **kw):
    try:
        from subprocess import proc_call
    except ImportError:
        # no subprocess for Python 2.3
        def proc_call(cmd, **kwargs):
            cwd = kwargs.get('cwd', '.')
            old_cwd = os.getcwd()
            try:
                os.chdir(cwd)
                return os.system(' '.join(cmd))
            finally:
                os.chdir(old_cwd)

    cwd = kw.get('cwd', '.')
    cmd_desc = ' '.join(cmd)
    log.info('Running "%s" in %s' % (cmd_desc, cwd))
    returncode = proc_call(cmd, **kw)
    if returncode:
        raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Ejemplo n.º 5
0
 def cmd(*args):
     cmd_line = list(head)
     cmd_line.extend(args)
     print(cmd_line)
     proc_call(cmd_line)