Skip to content

Commit 91c984c

Browse files
committed
execdocs first commit
1 parent cea2d24 commit 91c984c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Doc/library/sys.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,6 +2016,21 @@ always available. Unless explicitly noted otherwise, all variables are read-only
20162016
.. availability:: Unix, Windows.
20172017
.. versionadded:: 3.14
20182018

2019+
The temporary script file is created with restrictive permissions (typically
2020+
``0o600``). The target process must be able to read this file.
2021+
2022+
Callers should adjust permissions before calling, e.g.::
2023+
2024+
import os
2025+
import tempfile
2026+
import sys
2027+
2028+
with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
2029+
f.write("print('Hello from remote!')")
2030+
f.flush()
2031+
os.chmod(f.name, 0o644) # Readable by group/other
2032+
sys.remote_exec(pid, f.name)
2033+
os.unlink(f.name) # Cleanup
20192034

20202035
.. function:: _enablelegacywindowsfsencoding()
20212036

0 commit comments

Comments
 (0)