How to get all processes in a display from Xvfb?
Asked Answered
E

1

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?

Epeirogeny answered 18/12, 2015 at 21:43 Comment(4)
Hello , can you please share your code so we can have a look at the problem.Myrtlemyrvyn
That's not relevant to the question being asked.Epeirogeny
If I understand correctly, you want to kill all the driver instances after you are finished with you task?Myrtlemyrvyn
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.Epeirogeny
Z
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)
Zayas answered 18/12, 2015 at 21:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.