5 ms·
Presumably they start a new process and then exit the current one. `CreateProcess`[0] can allow the new process to inherit handles, etc. [0]: https://docs.micr
by ChrisSD 6y ago
Presumably they start a new process and then exit the current one. `CreateProcess`[0] can allow the new process to inherit handles, etc.
[0]: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw https://docs.microsoft.com/en-us/windows/win32/api/processth...
- gruez 6y ago>Presumably they start a new process and then exit the current one that's not exactly the same thing though. eg. if your parent process is waiting for you to exit, then creating a new process and then exiting will produce incorrect behavior. The same applies for anything that relies on pids.
- ChrisSD 6y agoI mean sure, it doesn't work exactly like Linux. It can't. Note there's nothing in the doc linked by twic that say these function maintain pids. > Each _exec function loads and executes a new process. All _exec functions use the same operating-system function (CreateProcess). I guess they could better emulate Linux using another layer of abstraction but I don't think they do. It is true that large parts of the C library in Windows is there only to emulate Unix like behaviour so as to make porting easier. But it's not meant to emulate Linux exactly (that's what WSL is for).
- deleted 6y ago[deleted]