You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code that closes all the file descriptors in the child process before exec breaks practically any and all efforts to debug exec errors; especially if they're not OSErrors.
In my case, I was debugging under pycharm. pydevd monkeypatched all the exec routines and because of a behavioural change in pexpect, where it re-encoded all the arguments as utf-8 encoded binary, rather than strings, when pydevd tried to detect the presence of python in it's code, it crashed out because there was encoding of the strings and bstring.endswith() needs to be passed a b'' string, or else it bombs out.
The text was updated successfully, but these errors were encountered:
petesh
added a commit
to petesh/ptyprocess
that referenced
this issue
Feb 26, 2019
The Python subprocess module also appears to close fds explicitly rather than setting CLOEXEC, although it happens in C code rather than Python. I'd want to hear from the maintainers of that whether there are any downsides to setting CLOEXEC before changing that.
Because it happens in python, it still leaves the cleanup of objects prior to the exec; which has hidden swallowed OSError exceptions coming from instances of classes being torn down who have file.close() calls in their __del__ methods.
It's not really safe code. CLOEXEC is a somewhat better solution as your code path is trying to get to only there, and if it fails, you always exit.
The code that closes all the file descriptors in the child process before exec breaks practically any and all efforts to debug exec errors; especially if they're not OSErrors.
In my case, I was debugging under pycharm. pydevd monkeypatched all the exec routines and because of a behavioural change in pexpect, where it re-encoded all the arguments as utf-8 encoded binary, rather than strings, when pydevd tried to detect the presence of python in it's code, it crashed out because there was encoding of the strings and bstring.endswith() needs to be passed a b'' string, or else it bombs out.
The text was updated successfully, but these errors were encountered: