Example #1
0
    def test_get_cmdline_from_pid_and_pid_invoked_with_cmdline(self):
        cmd = ['tail', '-f', self.test_file_path]
        proc = async_process.AsyncProcess(cmd)
        proc.start(block=True)
        self.addCleanup(proc.stop)

        pid = proc.pid
        self.assertEqual(cmd, utils.get_cmdline_from_pid(pid))
        self.assertTrue(utils.pid_invoked_with_cmdline(pid, cmd))
        self.assertEqual([], utils.get_cmdline_from_pid(-1))
    def is_active(self):
        # If using sudo rootwrap as a root_helper, we have to wait until sudo
        # spawns rootwrap and rootwrap spawns the process.

        return utils.pid_invoked_with_cmdline(self.pid,
                                              self.cmd_without_namespace)
Example #3
0
 def child_is_running():
     child_pid = utils.get_root_helper_child_pid(self.pid,
                                                 run_as_root=True)
     if utils.pid_invoked_with_cmdline(child_pid, self.cmd):
         return True
Example #4
0
 def child_is_running():
     child_pid = utils.get_root_helper_child_pid(
         self.pid, self.cmd, run_as_root=True)
     if utils.pid_invoked_with_cmdline(child_pid, self.cmd):
         return True
Example #5
0
    def is_active(self):
        # If using sudo rootwrap as a root_helper, we have to wait until sudo
        # spawns rootwrap and rootwrap spawns the process.

        return utils.pid_invoked_with_cmdline(
            self.pid, self.cmd_without_namespace)