Skip to content

Commit 2a96029

Browse files
committed
probe: keep the handle open while asking about inheritance
1 parent 68a5ffb commit 2a96029

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎.github/probe/o5_windows.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def blocking():
3939

4040
# Handle inheritance: Python's handles are non-inheritable; mcpp's CreateFileW
4141
# passes no SECURITY_ATTRIBUTES, so the same holds there.
42-
print("O5.win os.get_handle_inheritable(lock) =", os.get_handle_inheritable(msvcrt.get_osfhandle(open(lk).fileno())))
42+
fh = open(lk)
43+
print("O5.win os.get_handle_inheritable(lock) =", os.get_handle_inheritable(msvcrt.get_osfhandle(fh.fileno())))
44+
fh.close()
4345

4446
# A running executable: overwrite, rename aside, rename into place, delete.
4547
src = shutil.which("ping") or r"C:\Windows\System32\PING.EXE"

0 commit comments

Comments
 (0)