diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index f977f1389b61a5..81416d08f877a1 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1997,6 +1997,30 @@ always available. Unless explicitly noted otherwise, all variables are read-only interpreter is pre-release (alpha, beta, or release candidate) then the local and remote interpreters must be the same exact version. + Note that the remote process must be able to read the temporary script file in terms + of permissions. If the caller is running under different user than the process, + the caller should grant permissions (typically ``os.fchmod(filename, 0o644)``). + + Callers should adjust permissions before calling, for example:: + + import os + import sys + import tempfile + + # delete=False is required so the file persists after closing + f = tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) + try: + with f: + f.write("print('Hello from remote!')") + os.chmod(f.name, 0o644) + + sys.remote_exec(pid, f.name) + finally: + try: + os.unlink(f.name) + except OSError: + pass + See :ref:`remote-debugging` for more information about the remote debugging mechanism.