1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::{io, process::ExitStatus};

use super::super::kill;

#[non_exhaustive]
pub struct CommandStopped<T, R> {
    pub data: T,
    pub exit_status: io::Result<ExitStatus>,
    pub killed: Option<kill::KillJoinHandleFinalStatus<R>>,
}

impl<T, R> CommandStopped<T, R> {
    pub fn with_data<S>(self, new_data: S) -> (T, CommandStopped<S, R>) {
        let Self {
            data,
            exit_status,
            killed,
        } = self;
        (
            data,
            CommandStopped {
                data: new_data,
                exit_status,
                killed,
            },
        )
    }
}