File tree 1 file changed +20
-2
lines changed 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,32 @@ process via pipes.
6
6
7
7
``` rust,ignore
8
8
use std::io::prelude::*;
9
- use std::process::{Command, Stdio} ;
9
+ use std::process::Stdio;
10
10
11
11
static PANGRAM: &'static str =
12
12
"the quick brown fox jumped over the lazy dog\n";
13
13
14
14
fn main() {
15
15
// 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()
17
35
.stdin(Stdio::piped())
18
36
.stdout(Stdio::piped())
19
37
.spawn() {
You can’t perform that action at this time.
0 commit comments