typesafehub/webdriver

LocalBrowser should "monitor" the underlying process

jeantil opened this issue · 3 comments

Hello,

If the phantom process dies, it seems that the corresponding local browser will not die. The only way I have found to be notified of the process death is to make a call to p.exitValue()

Process#exitValue() is a blocking call this requires it being wrapped in a future whose result would be piped back to the actor to notify it of the process death.

Before I make the pull request, I need your advice on which execution context to make the blocking call. My current understanding is that making the call on the actor's execution context would be fine as long as I make sure to use scala.concurrent.blocking around the actual call.

Thanks

I discussed this with @hseeberger and he suggested using akka-contrib-extra akka.contrib.process.BlockingProcess instead of the current scala.sys.process.Process

I have implemented this change and will submit the pull request as soon as typesafehub/akka-contrib-extra#42 is merged and released as it is needed to preserve the current behaviour of logging phantomjs stdout to log.debug and stderr to log.error

cheers

a preview of the code I will submit in the PR is in https://github.com/jeantil/webdriver/tree/12-monitor-native-process

it has been brought to my attention that there is a better solution pending in akka.stream.io (akka/akka#17446) which can be used easily in webdriver.