| 1694 | // if our server goes away. |
| 1695 | impl Drop for WasmtimeServe { |
| 1696 | fn drop(&mut self) { |
| 1697 | match &mut self.child { |
| 1698 | Some(child) => match child.kill() { |
| 1699 | Ok(()) => {} |
| 1700 | Err(e) => { |
| 1701 | eprintln!("failed to kill child process {e}"); |
| 1702 | return; |
| 1703 | } |
| 1704 | }, |
| 1705 | None => return, |
| 1706 | } |
| 1707 | match self._finish() { |
| 1708 | Ok((stdout, stderr)) => { |
| 1709 | if !stdout.is_empty() { |
| 1710 | println!("server stdout:\n{stdout}"); |
| 1711 | } |
| 1712 | if !stderr.is_empty() { |
| 1713 | println!("server stderr:\n{stderr}"); |
| 1714 | } |
| 1715 | } |
| 1716 | Err(e) => println!("failed to wait for child or read stdio: {e}"), |
| 1717 | } |
| 1718 | } |
| 1719 | } |
| 1720 | |
| 1721 | #[tokio::test] |