(&self, child: &mut Child)
| 55 | } |
| 56 | |
| 57 | fn write_stdin(&self, child: &mut Child) { |
| 58 | if let Some(stdin) = self.stdin { |
| 59 | // Use scoped threads to avoid cloning stdin. |
| 60 | thread::scope(|s| { |
| 61 | s.spawn(|| { |
| 62 | let mut child_stdin = child.stdin.take().unwrap(); |
| 63 | child_stdin.write_all(stdin.as_bytes()).unwrap(); |
| 64 | child_stdin.flush().unwrap(); |
| 65 | }); |
| 66 | }); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | fn wait(&self, mut child: Child) -> Output { |
| 71 | if let Some(duration) = self.kill_after { |