How to get all the processes on display from Xvfb?

I have a program that starts ChromeDrivers, which launches the Chrome + browser, then tries to close both after completing some tasks (using Selenium). But often when my program cannot kill the ChromeDriver / Chrome browser. When I try to kill ChromeDriver, Chrome + browser, all other child processes are not destroyed.

I tried looking at / proc / x / environ to determine if I could extract the DISPLAY of this process, but found that such environment variable was not selected for the child processes of browser +.

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

+8
google-chrome process selenium selenium-chromedriver xvfb
source share
1 answer

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

xvfb-run sleep 60 & pid_xvfb=$! kill $(ps -o pid= --ppid $pid_xvfb) 
+1
source share

All Articles