Mirror of mitogen
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Go to file
Alex Willmer 598de81143 mitogen: Fix subprocess ResourceWarning
Python 3.x emits `ResourceWarning`s if certains resources aren't correctly
closed. Due to the way Mitogen has been terminating child processes this has
been occurring.

```
test_dev_tty_open_succeeds
(create_child_test.TtyCreateChildTest.test_dev_tty_open_succeeds) ...
/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/subprocess.py:1127:
ResourceWarning: subprocess 3313 is still running
  _warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok
```

During garbage collection subprocess.Popen() objects emit
ResourceWarning("subprocess 123 is still running")
if proc.returncode hasn't been set. Typically calling proc.wait() does so,
once the sub-process has exited. Calling os.waitpid(proc.pid, 0) also waits
for the sub-process to exit, but it doesn't update proc.returncode, so the
ResourceWarning is still emitted.

This change exposes `subprocess.Popen` methods on
`mitogen.parent.PopenProcess`, so that the returncode can be set.

See https://gist.github.com/moreati/b8d157ff82cb15234bece4033accc5e5
2 months ago
.ci ci: Drop macOS Python 3.12 + Ansible 9 tests 2 months ago
.github chore: Add issue templates for 0.2 vs 0.3 releases 4 years ago
ansible_mitogen patch #509 : ansible_ssh_common_args issues 2 months ago
docs tests: Test templating of ansible_ssh_common_args et al 2 months ago
examples Replace os.system() with subprocess.check_call() 3 years ago
mitogen mitogen: Fix subprocess ResourceWarning 2 months ago
scripts add Python3 compatibility 7 months ago
tests mitogen: Fix subprocess ResourceWarning 2 months ago
.gitignore Ignore Ansible retry files 8 months ago
.lgtm.yml Whoops, merge together lgtm.yml and .lgtm.yml 5 years ago
LICENSE Bump copyright year and use generic author name (testing Travis) 4 years ago
MANIFEST.in setup.py: include LICENSE; closes #538. 6 years ago
README.md Abandon Travis CI We have no credits, and its a PITA to maintain two CI platforms. The tests running on Travis provide very little extra coverage vs Azure Pipelines alone 3 years ago
dev_requirements.txt Split dev_requirements.txt up according to test mode. 6 years ago
preamble_size.py mitogen.parent: Remove tabs from minimized first stage 3 years ago
run_tests tests: Remove unittest2, use stdlib unittest 3 years ago
setup.cfg Declare universal wheel support 4 years ago
setup.py mitogen: Support Python 3.12 8 months ago
tox.ini tests: Unpin versions of Ansible 2.10, 3, & 4 2 months ago

README.md