コード例 #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))
コード例 #2
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)
コード例 #3
0
ファイル: net_helpers.py プロジェクト: whitepages/neutron
 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
コード例 #4
0
ファイル: net_helpers.py プロジェクト: 21atlas/neutron
 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
コード例 #5
0
ファイル: async_process.py プロジェクト: HoratiusTang/neutron
    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)