diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-12 01:01:35 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-12 01:01:43 +0900 |
| commit | 1e44f5723e4c0e0903d00a61f254901e612fe5e1 (patch) | |
| tree | 9c2e1eec364bbf6418a4072ee7767b04c3df0297 /crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs | |
| parent | ddf0a624145b618c05c2ee47414545b99b685f37 (diff) | |
| download | php-shirabe-1e44f5723e4c0e0903d00a61f254901e612fe5e1.tar.gz php-shirabe-1e44f5723e4c0e0903d00a61f254901e612fe5e1.tar.zst php-shirabe-1e44f5723e4c0e0903d00a61f254901e612fe5e1.zip | |
feat(symfony-console): port Symfony Console and make the workspace compile
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs b/crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs new file mode 100644 index 0000000..c9c06fa --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs @@ -0,0 +1,35 @@ +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 + } +} |
