blob: cfa4f4fb6f9e2dd1b50006e1f4eced3494a1ea90 (
plain)
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
29
30
31
32
33
34
35
36
37
|
//! ref: composer/vendor/symfony/console/Event/ConsoleTerminateEvent.php
use super::console_event::ConsoleEvent;
use crate::symfony::console::command::command::Command;
use crate::symfony::console::input::input_interface::InputInterface;
use crate::symfony::console::output::output_interface::OutputInterface;
/// Allows to manipulate the exit code of a command after its execution.
#[derive(Debug)]
pub struct ConsoleTerminateEvent {
inner: ConsoleEvent,
exit_code: i64,
}
impl ConsoleTerminateEvent {
pub fn new(
command: Box<dyn Command>,
input: Box<dyn InputInterface>,
output: Box<dyn OutputInterface>,
exit_code: i64,
) -> Self {
let mut instance = Self {
inner: ConsoleEvent::new(Some(command), input, output),
exit_code: 0,
};
instance.set_exit_code(exit_code);
instance
}
pub fn set_exit_code(&mut self, exit_code: i64) {
self.exit_code = exit_code;
}
pub fn get_exit_code(&self) -> i64 {
self.exit_code
}
}
|