pub struct JavaRuntime(pub PathBuf);Expand description
Wrapper around a Java binary path for process execution
Tuple Fields§
§0: PathBufImplementations§
Source§impl JavaRuntime
impl JavaRuntime
Sourcepub async fn execute(
&self,
arguments: Vec<String>,
game_dir: &Path,
) -> JavaRuntimeResult<Child>
pub async fn execute( &self, arguments: Vec<String>, game_dir: &Path, ) -> JavaRuntimeResult<Child>
Sourcepub async fn handle_io<D: Send + Sync>(
&self,
process: &mut Child,
on_stdout: fn(&D, &[u8]) -> JavaRuntimeResult<()>,
on_stderr: fn(&D, &[u8]) -> JavaRuntimeResult<()>,
terminator: Receiver<()>,
data: &D,
) -> JavaRuntimeResult<()>
pub async fn handle_io<D: Send + Sync>( &self, process: &mut Child, on_stdout: fn(&D, &[u8]) -> JavaRuntimeResult<()>, on_stderr: fn(&D, &[u8]) -> JavaRuntimeResult<()>, terminator: Receiver<()>, data: &D, ) -> JavaRuntimeResult<()>
Streams stdout/stderr from the process with custom handlers
This method handles I/O from the Java process, calling provided callbacks for stdout and stderr output. It continues until the process exits or the terminator signal is received.
§Arguments
process- Mutable reference to the child processon_stdout- Callback for stdout dataon_stderr- Callback for stderr dataterminator- Channel to signal early terminationdata- User data passed to callbacks
§Returns
Ok(()) on clean exit, or error if the process exits with non-zero code
§Note
Exit code -1073740791 (Windows forceful termination) is not treated as an error
Auto Trait Implementations§
impl Freeze for JavaRuntime
impl RefUnwindSafe for JavaRuntime
impl Send for JavaRuntime
impl Sync for JavaRuntime
impl Unpin for JavaRuntime
impl UnwindSafe for JavaRuntime
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more