Skip to content

Commit

Permalink
Fix #247 : set return code so ResourceWarning is not emited with pyth…
Browse files Browse the repository at this point in the history
…on >3.5
  • Loading branch information
Arnaud Aujon Chevallier committed May 25, 2020
1 parent a82aeb2 commit ba284a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions plugins/inkscape/inkcut_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ def effect(self):
close_fds=sys.platform != "win32")
p.stdin.write(etree.tostring(document) if VERSION == "1.X" else inkex.etree.tostring(document))
p.stdin.close()

# Set the returncode to avoid this warning when popen is garbage collected:
# "ResourceWarning: subprocess XXX is still running".
# See https://bugs.python.org/issue38890 and
# https://bugs.python.org/issue26741.
p.returncode = 0

if VERSION == "1.X":
if __name__ == '__main__':
Expand Down
6 changes: 5 additions & 1 deletion plugins/inkscape/inkcut_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def effect(self):
close_fds=sys.platform != "win32")
p.stdin.write(etree.tostring(document) if VERSION == "1.X" else inkex.etree.tostring(document))
p.stdin.close()

# Set the returncode to avoid this warning when popen is garbage collected:
# "ResourceWarning: subprocess XXX is still running".
# See https://bugs.python.org/issue38890 and
# https://bugs.python.org/issue26741.
p.returncode = 0

if VERSION == "1.X":
if __name__ == '__main__':
Expand Down

0 comments on commit ba284a1

Please sign in to comment.