Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill phantomjs processes running in background after the tests are completed

After I run the phatomjs/java integration tests on the build server , the phantomjs processes still keep running in the background and have to be killed manually.

Is there a way to do this in the java code? I am already using driver.quit() in the test cleanup part. Is there anything else also to be included?

like image 796
WorryNerd Avatar asked Feb 11 '15 22:02

WorryNerd


1 Answers

The simplest way (not necessarily the formal way) to deal with this issue is to shoot a kill command from bash script that terminates all phantomjs processes:

ps -ef | grep phantomjs | awk '{print $2}' | xargs sudo kill -9

The above script run in terminal will kill all background phantomjs whether you have started them using java or python or ruby... A quick workaround till the actual bug gets solved, imo.

like image 74
Abhimanu Kumar Avatar answered Nov 15 '22 04:11

Abhimanu Kumar