8

I have a program that is launching ChromeDrivers, which launches Chrome browsers + later attempts to close both after doing some task (using Selenium). But often times my program can't kill off the ChromeDriver/Chrome browser. When I try to kill the ChromeDriver the Chrome browser + all it's other child processes aren't killed off.

I have tried to look at /proc/x/environ to determine if I can extract the DISPLAY of the process, but found that no such environment variable was set for the browser + child processes.

Is there any other way to detect all processes in a specific Xvfb display and kill them all?

Ben
  • 1,550
  • 3
  • 15
  • 22
  • Hello , can you please share your code so we can have a look at the problem. – Shah Dec 18 '15 at 22:18
  • That's not relevant to the question being asked. – Ben Dec 18 '15 at 22:21
  • If I understand correctly, you want to kill all the driver instances after you are finished with you task? – Shah Dec 18 '15 at 22:24
  • Chrome was just the primary thing of concern, but is not limited to Chrome. I need a way to obtain all processes for a display in Xvfb. – Ben Dec 18 '15 at 22:34

1 Answers1

1

This looks quite promising if you only have one child process:

xvfb-run sleep 60 &
pid_xvfb=$!
kill $(ps -o pid= --ppid $pid_xvfb)
Matthias
  • 7,432
  • 6
  • 55
  • 88