简体   繁体   中英

How to get all processes in a display from Xvfb?

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM