| 1 | //! Process I/O requests and responses. |
| 2 | |
| 3 | use std::process::Output as SpawnOutput; |
| 4 | |
| 5 | use crate::{command::Command, status::SpawnStatus}; |
| 6 | |
| 7 | /// The process I/O request enum, emitted by [coroutines] and |
| 8 | /// processed by [runtimes]. |
| 9 | /// |
| 10 | /// Represents all the possible I/O requests that a stream coroutine |
| 11 | /// can emit. Runtimes should be able to handle all variants. |
| 12 | /// |
| 13 | /// [coroutines]: crate::coroutines |
| 14 | /// [runtimes]: crate::runtimes |
| 15 | #[derive(Debug)] |
| 16 | pub enum ProcessIo { |
| 17 | /// I/O for spawning a process and waiting for its exit status. |
| 18 | /// |
| 19 | /// Input: command |
| 20 | /// |
| 21 | /// Output: spawn status |
| 22 | SpawnThenWait(Result<SpawnStatus, Command>), |
| 23 | |
| 24 | /// I/O for spawning a process and waiting for its exit status and |
| 25 | /// any potential output from stdout or stderr. |
| 26 | /// |
| 27 | /// Input: command |
| 28 | /// |
| 29 | /// Output: spawn output |
| 30 | SpawnThenWaitWithOutput(Result<SpawnOutput, Command>), |
| 31 | } |