Skip to content

core::run and rust_run_program.cpp do unsafe and leaky things on windows #5976

Closed
@Dretch

Description

@Dretch

When starting a child process on Windows then rust_run_program.cpp casts a process HANDLE to int and then core::run pretends that it is really a process id (a pid_t).

This is bad because (on Windows):

  • The HANDLE never gets closed (it leaks).
  • It means calling core::os::waitpid or core::run::waitpid with a pid_t that wasn't retrieved from rust_run_program will result in undefined behaviour.
  • it means that calling core::run::Program.get_id returns a value that isn't really the process id.

I will send a pull request to address these issues, unless there are objections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions