Eryk Sun <eryk...@gmail.com> added the comment:

> On Windows, the new process is executed in the background but 
> can send output to a console if the original process was 
> started in a console.

C execv[e]() is a mess for console applications. The child process is competing 
for console input with an ancestor process in the console session, which is 
typically a CLI shell such as CMD or PowerShell. This is dysfunctional. It's 
worth either fixing or deprecating. It's not worth documenting since it's way 
off spec compared to exec() in POSIX systems. exec() is supposed to overlay the 
current process with a new image, not terminate the current process. That 
cannot be implemented in Windows, but we could do our best to emulate it. 

The implementation could leave the current Python process running in much the 
same way as a launcher functions, i.e. wait for the child process to exit and 
proxy its exit status, and set the child process in a kill-on-close job object.

It would be better at this point to use subprocess.Popen() to implement 
os.exec*, considering it can work concurrently with itself, without race 
conditions involving inheritable handles. nt.spawnv[e](), nt.waitpid(), and 
nt.system() could also be implemented with subprocess.

----------
assignee: docs@python -> 
components: +Extension Modules, Library (Lib) -Documentation
versions: +Python 3.10 -Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue19124>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to