File tree Expand file tree Collapse file tree 1 file changed +8
-19
lines changed Expand file tree Collapse file tree 1 file changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -13,25 +13,14 @@ static PANGRAM: &'static str =
13
13
14
14
fn main() {
15
15
// Spawn the `wc` command
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()
16
+ let mut cmd = if cfg!(target_family = "windows") {
17
+ let mut cmd = Command::new("powershell");
18
+ cmd.arg("-Command").arg("$input | Measure-Object -Line -Word -Character");
19
+ cmd
20
+ } else {
21
+ Command::new("wc")
22
+ };
23
+ let process = match cmd
35
24
.stdin(Stdio::piped())
36
25
.stdout(Stdio::piped())
37
26
.spawn() {
You can’t perform that action at this time.
0 commit comments