示例#1
0
 def testspawndetachedfailure1(self):
     """spawndetached() should throw if executing the process fails."""
     try:
         util.spawndetached(["no_such_program", "arg1", "arg2"])
         self.fail("expected spawndetached to fail with ENOENT")
     except (OSError, IOError) as ex:
         self.assertEqual(ex.errno, errno.ENOENT)
示例#2
0
 def testspawndetachedfailure2(self):
     """spawndetached() should throw if executing the process fails."""
     try:
         util.spawndetached([os.devnull, "arg1", "arg2"])
         self.fail("expected spawndetached to fail with EACCES")
     except (OSError, IOError) as ex:
         self.assertEqual(ex.errno, errno.EPERM)
示例#3
0
 def testspawndetachednoblock(self):
     """spawndetached() should return without waiting for the process to
     finish."""
     start = time.time()
     util.spawndetached(["sleep", "5"])
     end = time.time()
     if end - start >= 1.0:
         self.fail("spawndetached() took took %s seconds, should have "
                   "returned immediately" % (end - start))
示例#4
0
文件: repack.py 项目: leszfb/eden
def backgroundrepack(repo, incremental=True):
    cmd = [util.hgexecutable(), "-R", repo.origroot, "repack"]
    msg = _("(running background repack)\n")
    if incremental:
        cmd.append("--incremental")
        msg = _("(running background incremental repack)\n")

    if not repo.ui.quiet:
        repo.ui.write_err(msg)
    util.spawndetached(cmd)
示例#5
0
        def backgroundprefetch(
            self, revs, base=None, repack=False, pats=None, opts=None
        ):
            """Runs prefetch in background with optional repack"""
            cmd = [util.hgexecutable(), "-R", self.origroot, "prefetch"]
            if repack:
                cmd.append("--repack")
            if revs:
                cmd += ["-r", revs]
            if base:
                cmd += ["-b", base]

            util.spawndetached(cmd)