Sha256: 9c003770a8bf850de2f7096d35d192a619e262f4198c6a722a69ec51dddebf30

Contents?: true

Size: 610 Bytes

Versions: 5

Compression:

Stored size: 610 Bytes

Contents

#![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(windows)]
#![cfg(not(miri))]

use tokio::process::Command;
use windows_sys::Win32::System::Threading::GetProcessId;

#[tokio::test]
async fn obtain_raw_handle() {
    let mut cmd = Command::new("cmd");
    cmd.kill_on_drop(true);
    cmd.arg("/c");
    cmd.arg("pause");

    let child = cmd.spawn().unwrap();

    let orig_id = child.id().expect("missing id");
    assert!(orig_id > 0);

    let handle = child.raw_handle().expect("process stopped");
    let handled_id = unsafe { GetProcessId(handle as _) };
    assert_eq!(handled_id, orig_id);
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/tokio-1.43.0/tests/process_raw_handle.rs
wasmtime-29.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/process_raw_handle.rs
wasmtime-28.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/process_raw_handle.rs
wasmtime-27.0.0 ./ext/cargo-vendor/tokio-1.41.1/tests/process_raw_handle.rs
wasmtime-26.0.0 ./ext/cargo-vendor/tokio-1.41.0/tests/process_raw_handle.rs