extern crate relaunch;
use std::{io::Write, process::ExitCode};
fn main() {
relaunch::Trampoline::new("re-Terminal", "com.github.maaku.relauncher.Terminal")
.version("1.0.0")
.run_once(relaunch::InstallDir::Temp, |app| {
assert!(relaunch::Trampoline::is_bundled());
println!(
"Application relaunched successfully from {}",
app.bundle_path.to_str().unwrap()
);
print!("Please enter your name: ");
eprintln!("This should come before the prompt.");
std::io::stdout().flush().unwrap();
let mut name = String::new();
std::io::stdin()
.read_line(&mut name)
.expect("Failed to read line");
if name.ends_with('\n') {
name.pop();
}
println!("Hello, {}!", name);
ExitCode::SUCCESS
})
}