You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::io::Write;use std::process::{Command,Stdio};letmut child = Command::new("rev").stdin(Stdio::piped()).stdout(Stdio::piped()).spawn().expect("Failed to spawn child process");{let stdin = child.stdin.as_mut().expect("Failed to open stdin");
stdin.write_all("Hello, world!".as_bytes()).expect("Failed to write to stdin");}let output = child.wait_with_output().expect("Failed to read stdout");assert_eq!(String::from_utf8_lossy(&output.stdout),"!dlrow ,olleH");
When I click run button, it runs on play.rust-lang.org, nothing assert_eq is triggered as below:
Compiling playground v0.0.1 (/playground)
Finished dev [unoptimized + debuginfo] target(s) in 0.65s
Running target/debug/playground
But when I copy the codes to my platform, the assert_eq is triggered as below: $ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Running target/debug/combine
thread 'main' panicked at 'assertion failed: (left == right)
left: "!dlrow ,olleH\n",
right: "!dlrow ,olleH"', src/main.rs:18:1
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Linux version 3.10.0-1062.12.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Feb 4 23:02:59 UTC 2020
@tiide Thank you for your issue! This repository is only for the website. The API docs source is in rust-lang/rust, so I would recommend creating an issue there instead.
Different result of std::process::Command's example on different platform
The example is located at https://doc.rust-lang.org/std/process/struct.Stdio.html
When I click run button, it runs on play.rust-lang.org, nothing assert_eq is triggered as below:
But when I copy the codes to my platform, the assert_eq is triggered as below:
$ cargo run
My platform info
Name: VMware® Workstation 15 Pro; Ver: 15.5.0 build-14665864
$ cargo -V
$ rustc -V
$ cat /proc/version
$ lsb_release -a
The text was updated successfully, but these errors were encountered: