Skip to content

Semantics of Process.exec on Windows #14422

@HertzDevil

Description

@HertzDevil

The current documentation for Process.exec is:

Replaces the current process with a new one. This function never returns.

Raises IO::Error if executing the command fails (for example if the executable doesn't exist).

But on Windows it doesn't preserve the process ID like on other systems, so calling it "replaces" is probably not accurate. The Windows documentation for the _exec family doesn't contain any references about "replacing the current process" either. This is a fundamental limitation of the Win32 API, and it is unlikely we could match the POSIX semantics here. For reference, Wine simply calls CreateProcessW followed by _exit(0).

So I think we should change the documentation to make it more platform-agnostic, as well as elaborate on whether opened files (Win32 handles? C file descriptors?) and the environment are inherited.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions