summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/tests/io/dup2_to_replace_stdio.rs
blob: b07ec17f0d37a48df542cadbc035d317b4da877a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![cfg(not(target_os = "wasi"))]

use std::env;
use std::process::Command;

/// Use `dup2` to replace the stdin and stdout file descriptors.
#[test]
fn dup2_to_replace_stdio() {
    // This test modifies the stdio file descriptors, so we run it in a
    // separate process so that it doesn't interfere with the test harness.
    assert!(Command::new(env::var("CARGO").unwrap())
        .arg("run")
        .arg("--example")
        .arg("dup2_to_replace_stdio")
        .status()
        .unwrap()
        .success());
}