Jul-01-2023, 08:43 AM
(This post was last modified: Jul-01-2023, 08:44 AM by Gribouillis.)
(Jul-01-2023, 12:48 AM)Skaperen Wrote: when any Python library forks a new process, does it make whatever is in sys.stdout, which may be using some other fd, such as fd 6, instead of fd 1, become fd 1There is a lot of confusion here because you are mixing low-level concepts that belong to the C implementation of Python (such as file descriptors) with high-level concepts such as
sys.stdin
and sys.stdout
which are abstract Python file objects that don't even need a file descriptor. The original question is too broad. If you want to do OS level operations in CPython, then use the available functions in modules such as os
and subprocess
. Most of what you do in C can be done in CPython, you are allowed to use functions such as os.fork
or os.dup2
, etc.