Example #1
0
    def test_interrupt(self):
        """
        CAN WE CATCH A SIGINT?
        """
        p = Process("not much" ["python", "tests/resources/utils/wait_for_signal.py"])
        k = Process("killer", ["kill", "-SIGINT", p.pid])

        p.join()
Example #2
0
def get_git_revision():
    """
    GET THE CURRENT GIT REVISION
    """
    proc = Process("git log", ["git", "log", "-1"])

    try:
        while True:
            line = proc.stdout.pop().strip()
            if not line:
                continue
            if line.startswith("commit "):
                return line[7:]
    finally:
        with suppress_exception:
            proc.join()
Example #3
0
def get_git_revision():
    """
    GET THE CURRENT GIT REVISION
    """
    proc = Process("git log", ["git", "log", "-1"])

    try:
        while True:
            line = proc.stdout.pop().strip()
            if not line:
                continue
            if line.startswith("commit "):
                return line[7:]
    finally:
        with suppress_exception:
            proc.join()
Example #4
0
    def run_job(self, job):
        process = Process(name=job.name,
                          params=job.command,
                          cwd=job.directory,
                          env=job.environment)

        # DIRECT OUTPUT TO FILES
        self.add_file(
            process.stdout,
            coalesce(job.stdout,
                     File.newInstance(self.settings.log.directory, job.name)))
Example #5
0
def get_remote_revision(url, branch):
    """
    GET REVISION OF A REMOTE BRANCH
    """

    proc = Process("git remote revision", ["git", "ls-remote", url, "refs/heads/" + branch])

    try:
        while True:
            line = proc.stdout.pop().strip()
            if not line:
                continue
            return line.split("\t")[0]
    finally:
        try:
            proc.join()
        except Exception:
            pass

    return None
Example #6
0
def get_remote_revision(url, branch):
    """
    GET REVISION OF A REMOTE BRANCH
    """

    proc = Process("git remote revision",
                   ["git", "ls-remote", url, "refs/heads/" + branch])

    try:
        while True:
            line = proc.stdout.pop().strip()
            if not line:
                continue
            return line.split("\t")[0]
    finally:
        try:
            proc.join()
        except Exception:
            pass

    return None