Skip to content

Commit

Permalink
Hide the terminals when we're not in debug mode or they're not shown.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frodo45127 committed Mar 3, 2024
1 parent 8217b13 commit 0961efe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions runcher/src/mod_manager/integrations/steam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ pub fn request_mods_data_raw(game: &GameInfo, mod_ids: &[String]) -> Result<Vec<
// This is for creating the terminal window. Without it, the entire process runs in the background and there's no feedback on when it's done.
#[cfg(target_os = "windows")] if cfg!(debug_assertions) {
command.creation_flags(0x00000008);
} else {
command.creation_flags(0x08000000);
}

command.spawn()?;
Expand Down
18 changes: 12 additions & 6 deletions workshopper/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,29 @@ fn main() {
info!("{:?}", cli.command);

// Execute the commands.
let result: Result<()> = match cli.command {
Commands::GetPublishedFileDetails { steam_id, published_file_ids } => crate::commands::ugc::published_file_details(steam_id, &published_file_ids),
Commands::Upload { steam_id, file_path, title, description, tags, changelog, visibility } => crate::commands::ugc::upload(steam_id, &file_path, &title, &description, &tags, &changelog, &visibility),
Commands::Update { steam_id, published_file_id, file_path, title, description, tags, changelog, visibility } => crate::commands::ugc::update(None, None, PublishedFileId(published_file_id), steam_id, &file_path, &title, &description, &tags, &changelog, &visibility)
let (result, wait): (Result<()>, bool) = match cli.command {
Commands::GetPublishedFileDetails { steam_id, published_file_ids } => (crate::commands::ugc::published_file_details(steam_id, &published_file_ids), false),
Commands::Upload { steam_id, file_path, title, description, tags, changelog, visibility } => (crate::commands::ugc::upload(steam_id, &file_path, &title, &description, &tags, &changelog, &visibility), true),
Commands::Update { steam_id, published_file_id, file_path, title, description, tags, changelog, visibility } => (crate::commands::ugc::update(None, None, PublishedFileId(published_file_id), steam_id, &file_path, &title, &description, &tags, &changelog, &visibility), true)
};

// Output the result of the commands, then give people 60 seconds to read them before exiting.
match result {
Ok(_) => {
info!("Done. This terminal will close itself in 60 seconds to give you some time to read the log, but if you want, you can close it now.");
std::thread::sleep(std::time::Duration::from_millis(60000));
if cfg!(debug_assertions) || wait {
std::thread::sleep(std::time::Duration::from_millis(60000));
}

exit(0)
},
Err(error) => {
error!("{}", error.to_string());
info!("This terminal will close itself in 60 seconds to give you some time to read the log, but if you want, you can close it now.");
std::thread::sleep(std::time::Duration::from_millis(60000));
if cfg!(debug_assertions) || wait {
std::thread::sleep(std::time::Duration::from_millis(60000));
}

exit(1);
},
}
Expand Down

0 comments on commit 0961efe

Please sign in to comment.