Exemplo n.º 1
0
def ldconfig():
	# Setup the message
	Print.status("Running 'ldconfig'")

	# Skip ldconfig on Cygwin
	if Config.os_type in OSType.Cygwin:
		Print.ok()
		return

	# Find ldconfig
	prog = Find.program_paths('ldconfig')
	if not prog:
		Print.fail()
		Print.exit("Could not find 'ldconfig'.")

	# Run the process
	runner = findlib.ProcessRunner(prog[0])
	runner.run()
	runner.is_done
	runner.wait()

	# Success or failure
	if runner.is_failure:
		Print.fail(runner.stdall)
		Print.exit("Failed run 'ldconfig'.")
	elif runner.is_success or runner.is_warning:
		Print.ok()
Exemplo n.º 2
0
def run_print(command):
    Print.status("Running C++ program")

    native_command = to_native(command)
    runner = findlib.ProcessRunner(native_command)
    runner.run()
    runner.is_done
    runner.wait()

    if runner.is_success or runner.is_warning:
        Print.ok()
        sys.stdout.write(command + '\n')
        sys.stdout.write(runner.stdall)
    elif runner.is_failure:
        Print.fail()
        sys.stdout.write(command + '\n')
        sys.stdout.write(runner.stdall)
        Print.exit('Failed to run command.')
Exemplo n.º 3
0
def do_on_fail_exit(start_message, fail_message, cb):
    Print.status(start_message)

    # Run it if it is a function
    if hasattr(cb, '__call__'):
        try:
            cb()
            Print.ok()
        except Exception as e:
            Print.fail()
            Print.exit(fail_message)
    # Or run it as a process if a string
    elif type(cb) == str:
        runner = findlib.ProcessRunner(cb)
        runner.run()
        runner.is_done
        runner.wait()
        if runner.is_success or runner.is_warning:
            Print.ok()
        elif runner.is_failure:
            Print.fail()
            Print.exit(fail_message)
Exemplo n.º 4
0
    def run(self):
        # Show the concurrent header
        if Event.is_concurrent:
            if Event.is_first_concurrent:
                Event.is_first_concurrent = False
                sys.stdout.write("{0} {1} concurrently ...\n".format(
                    self._task, self._plural))
                sys.stdout.flush()
                Print.message_length = 0

        # Run the setup function
        if not self._setup_cb():
            return False

        # Show the serial message
        if not Event.is_concurrent:
            Print.status("{0} {1} '{2}'".format(self._task, self._singular,
                                                self._result))

        # Start the process
        self._runner = findlib.ProcessRunner(self._command)
        self._status = 'running'
        self._runner.run()
        return True