Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
moreati committed Jan 12, 2025
1 parent 23939cb commit d079039
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
4 changes: 3 additions & 1 deletion mitogen/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,9 @@ def _first_stage():
os.environ['ARGV0']=sys.executable
os.execl(sys.executable,sys.executable+'(mitogen:CONTEXT_NAME)')
os.write(1,'MITO000\n'.encode())
C=zlib.decompress(os.fdopen(0,'rb').read(PREAMBLE_COMPRESSED_LEN))
fp=os.fdopen(0,'rb')
C=zlib.decompress(fp.read(PREAMBLE_COMPRESSED_LEN))
fp.close()
fp=os.fdopen(W,'wb',0)
fp.write(C)
fp.close()
Expand Down
22 changes: 20 additions & 2 deletions tests/data/fd_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def controlling_tty():
return None


out_path = sys.argv[1]
fd = int(sys.argv[2])
st = os.fstat(fd)

Expand All @@ -35,12 +36,29 @@ def controlling_tty():
else:
buf = os.read(fd, 4).decode()

open(sys.argv[1], 'w').write(repr({
output = repr({
'buf': buf,
'flags': fcntl.fcntl(fd, fcntl.F_GETFL),
'st_mode': st.st_mode,
'st_dev': st.st_dev,
'st_ino': st.st_ino,
'ttyname': ttyname(fd),
'controlling_tty': controlling_tty(),
}))
})

try:
out_f = open(out_path, 'w')
except Exception:
exc = sys.exc_info()[1]
sys.stderr.write("Failed to open %r: %r" % (out_path, exc))
sys.exit(1)

try:
out_f.write(output)
except Exception:
out_f.close()
exc = sys.exc_info()[1]
sys.stderr.write("Failed to write to %r: %r" % (out_path, exc))
sys.exit(2)

out_f.close()
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ setenv =
NOCOVERAGE_ERASE = 1
NOCOVERAGE_REPORT = 1
PIP_CONSTRAINT={toxinidir}/tests/constraints.txt
# Print a warning on the first occurence at each module:linenno. Available Python 2.7, 3.2+.
PYTHONWARNINGS=default
# Ansible 6 - 8 (ansible-core 2.13 - 2.15) require Python 2.7 or >= 3.5 on targets
ansible6: MITOGEN_TEST_DISTRO_SPECS=centos7 centos8 debian9 debian10 debian11 ubuntu1604 ubuntu1804 ubuntu2004
ansible7: MITOGEN_TEST_DISTRO_SPECS=centos7 centos8 debian9 debian10 debian11 ubuntu1604 ubuntu1804 ubuntu2004
Expand Down Expand Up @@ -137,6 +135,9 @@ setenv =
mode_debops_common: MODE=debops_common
mode_localhost: ANSIBLE_SKIP_TAGS=issue_776,resource_intensive
mode_mitogen: MODE=mitogen
# Print a warning on the first occurence at each module:linenno.
# Availability: Python 2.7, 3.2+.
py313: PYTHONWARNINGS=default
strategy_linear: ANSIBLE_STRATEGY=linear
allowlist_externals =
# Added: Tox 3.18: Tox 4.0+
Expand Down

0 comments on commit d079039

Please sign in to comment.