File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,32 @@ process via pipes.
66
77``` rust,ignore
88use std::io::prelude::*;
9- use std::process::{Command, Stdio} ;
9+ use std::process::Stdio;
1010
1111static PANGRAM: &'static str =
1212"the quick brown fox jumped over the lazy dog\n";
1313
1414fn main() {
1515 // Spawn the `wc` command
16- let process = match Command::new("wc")
16+ #[cfg(target_family = "unix")]
17+ mod platform {
18+ use std::process::Command;
19+ pub fn wc() -> Box<Command> {
20+ let process = Command::new("wc");
21+ Box::new(process)
22+ }
23+ }
24+ #[cfg(target_family = "windows")]
25+ mod platform {
26+ use std::process::Command;
27+ pub fn wc() -> Box<Command> {
28+ let mut process = Command::new("powershell");
29+ process.arg("-Command").arg("$input | Measure-Object -Line -Word -Character");
30+ Box::new(process)
31+ }
32+ }
33+
34+ let process = match platform::wc()
1735 .stdin(Stdio::piped())
1836 .stdout(Stdio::piped())
1937 .spawn() {
You can’t perform that action at this time.
0 commit comments