Beispiel #1
0
    def test_kill_process(self):
        executive = Executive()
        process = subprocess.Popen(never_ending_command(),
                                   stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)

        # Killing again should fail silently.
        executive.kill_process(process.pid)
Beispiel #2
0
    def test_kill_process(self):
        executive = Executive()
        if sys.platform == 'win32':
            process = subprocess.Popen(never_ending_command(),
                                       stdout=subprocess.PIPE)
        else:
            process = subprocess.Popen(never_ending_command(),
                                       stdout=subprocess.PIPE,
                                       preexec_fn=lambda: os.setpgid(0, 0))

        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)

        # Killing again should fail silently.
        executive.kill_process(process.pid)