Wrapper around execv():

    * fork()s before exec()ing (in order to run the command in a subprocess)
    * wait for the subprocess to finish before returning (blocks the parent
      process)

    This is **hyper** simplistic. This *does not* handle **many** edge cases.

    *DO NOT DO THIS*: subprocess.check_call() does it better, and handle edge
    cases.

def execute(path, arguments):
    """
    Wrapper around execv():

    * fork()s before exec()ing (in order to run the command in a subprocess)
    * wait for the subprocess to finish before returning (blocks the parent
      process)

    This is **hyper** simplistic. This *does not* handle **many** edge cases.

    *DO NOT DO THIS*: subprocess.check_call() does it better, and handle edge
    cases.
    """
    pid = os.fork()
    if pid == 0:
        try:
            os.execv(path, arguments)
        finally:
            sys.exit(1)  # In case path is not executable
    else:
        try:
            # Wait for subprocess to finish
            os.waitpid(pid, NORMAL_PIDWAIT)
        except OSError:
            pass  # The subprocess was already finish
        return