Exemplo n.º 1
0
def run_command(command, verbose=False):
	log = utils.buffer()
	out = log
	error = utils.quotedFile(log, "\033[31m", "\033[0m")
	message=''
	if verbose:
		message = "Running: '%s'"%command
		out = utils.tee(log, sys.stdout)
		error = utils.tee(error, sys.stderr)

	ok = utils.run(command, log=out, err=error, fatal=False, message=message)
	return log.output(), ok
Exemplo n.º 2
0
def run_command(command, verbose=False):
    log = utils.buffer()
    out = log
    error = utils.quotedFile(log, "\033[31m", "\033[0m")
    message = ''
    if verbose:
        message = "Running: '%s'" % command
        out = utils.tee(log, sys.stdout)
        error = utils.tee(error, sys.stderr)

    ok = utils.run(command, log=out, err=error, fatal=False, message=message)
    return log.output(), ok
Exemplo n.º 3
0
    def run(self, subst=dict(), cwd=None):
        log = utils.buffer()
        error = utils.quotedFile(log, "\033[31m", "\033[0m")
        ok = utils.run(
            self.commandline.format(**subst),
            log=log,
            err=error,
            fatal=False,
            message='',
            cwd=cwd,
        )
        output = log.output()
        if self.ok is not None: ok = self.ok(output, ok)
        info = None if self.info is None else self.info(output)
        stats = dict([(stat,
                       retriever(output) if callable(retriever) else retriever)
                      for stat, retriever in self.stats.iteritems()])

        return output, ok, info, stats
Exemplo n.º 4
0
	def run(self, subst=dict(), cwd=None) :
		log = utils.buffer()
		error = utils.quotedFile(log, "\033[31m", "\033[0m")
		ok = utils.run(
			self.commandline.format(**subst),
			log = log,
			err = error,
			fatal = False,
			message = '',
			cwd = cwd,
			)
		output = log.output()
		if self.ok is not None : ok = self.ok(output, ok)
		info = None if self.info is None else self.info(output)
		stats = dict([
			(stat, retriever(output) if callable(retriever) else retriever )
			for stat, retriever in self.stats.iteritems()
			])

		return output, ok, info, stats