Skip to content

Converting std::process::Child::id() to struct Pid requires a cast #656

Open
@marmistrz

Description

@marmistrz

Currently we need something like:

let child = Command::new("ls").arg("-l").spawn().unwrap();
let pid = Pid::from_raw(child.id() as i32);

while id() returns a u32.

fn id(&self) -> u32

This itself poses no risk on Linux, since the hard PID limit is 2^22, but this cast should not be necessary, imho.

Btw. nix::unistd::Pid is not mentioned in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions