Skip to content

Commit

Permalink
Close phantomjs instance after take screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Dec 5, 2016
1 parent 1dbec43 commit c53b74c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ Changelog
1.0a1 (unreleased)
------------------

- Close phantomjs instance after take screenshot (fixes `#34`_).
[rodfersou]

- Fix extra space between text and quotes (pseudo element).
[rodfersou]

.. _`#34`: https://github.com/collective/collective.behavior.featuredimage/issues/34
5 changes: 5 additions & 0 deletions src/collective/behavior/featuredimage/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from plone.namedfile.file import NamedBlobImage
from selenium import webdriver

import signal
import transaction


Expand All @@ -28,6 +29,10 @@ def _get_screenshot(page):
im.save(output, 'PNG')
data = output.getvalue()
output.close()
driver.close()
# http://stackoverflow.com/a/3849328
driver.service.process.send_signal(signal.SIGTERM)
driver.quit()
return data


Expand Down

0 comments on commit c53b74c

Please sign in to comment.