Esempio n. 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()
Esempio n. 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()
Esempio n. 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()
Esempio n. 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)))
Esempio n. 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
Esempio n. 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