You've already forked AstralRinth
forked from didirus/AstralRinth
Analytics + more bug fixes (#144)
* Analytics + more bug fixes * debug deadlock * Fix mostly everything * merge fixes * fix rest * final fixeS
This commit is contained in:
@@ -69,9 +69,9 @@ pub async fn get_uuids_by_profile_path(
|
||||
children.running_keys_with_profile(profile_path).await
|
||||
}
|
||||
|
||||
// Gets stdout of a child process stored in the state by UUID, as a string
|
||||
// Gets output of a child process stored in the state by UUID, as a string
|
||||
#[tracing::instrument]
|
||||
pub async fn get_stdout_by_uuid(uuid: &Uuid) -> crate::Result<String> {
|
||||
pub async fn get_output_by_uuid(uuid: &Uuid) -> crate::Result<String> {
|
||||
let state = State::get().await?;
|
||||
// Get stdout from child
|
||||
let children = state.children.read().await;
|
||||
@@ -79,7 +79,7 @@ pub async fn get_stdout_by_uuid(uuid: &Uuid) -> crate::Result<String> {
|
||||
// Extract child or return crate::Error
|
||||
if let Some(child) = children.get(uuid) {
|
||||
let child = child.read().await;
|
||||
Ok(child.stdout.get_output().await?)
|
||||
Ok(child.output.get_output().await?)
|
||||
} else {
|
||||
Err(crate::ErrorKind::LauncherError(format!(
|
||||
"No child process by UUID {}",
|
||||
@@ -89,26 +89,6 @@ pub async fn get_stdout_by_uuid(uuid: &Uuid) -> crate::Result<String> {
|
||||
}
|
||||
}
|
||||
|
||||
// Gets stderr of a child process stored in the state by UUID, as a string
|
||||
#[tracing::instrument]
|
||||
pub async fn get_stderr_by_uuid(uuid: &Uuid) -> crate::Result<String> {
|
||||
let state = State::get().await?;
|
||||
// Get stdout from child
|
||||
let children = state.children.read().await;
|
||||
|
||||
// Extract child or return crate::Error
|
||||
if let Some(child) = children.get(uuid) {
|
||||
let child = child.read().await;
|
||||
Ok(child.stderr.get_output().await?)
|
||||
} else {
|
||||
Err(crate::ErrorKind::LauncherError(format!(
|
||||
"No child process with UUID {}",
|
||||
uuid
|
||||
))
|
||||
.as_error())
|
||||
}
|
||||
}
|
||||
|
||||
// Kill a child process stored in the state by UUID, as a string
|
||||
#[tracing::instrument]
|
||||
pub async fn kill_by_uuid(uuid: &Uuid) -> crate::Result<()> {
|
||||
@@ -150,7 +130,7 @@ pub async fn kill(running: &mut MinecraftChild) -> crate::Result<()> {
|
||||
pub async fn wait_for(running: &mut MinecraftChild) -> crate::Result<()> {
|
||||
// We do not wait on the Child directly, but wait on the thread manager.
|
||||
// This way we can still run all cleanup hook functions that happen after.
|
||||
let result = running
|
||||
running
|
||||
.manager
|
||||
.take()
|
||||
.ok_or_else(|| {
|
||||
@@ -166,12 +146,5 @@ pub async fn wait_for(running: &mut MinecraftChild) -> crate::Result<()> {
|
||||
))
|
||||
})?;
|
||||
|
||||
match result.success() {
|
||||
false => Err(crate::ErrorKind::LauncherError(format!(
|
||||
"Minecraft exited with non-zero code {}",
|
||||
result.code().unwrap_or(-1)
|
||||
))
|
||||
.as_error()),
|
||||
true => Ok(()),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user