main.rs 781 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2019-2024 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. use tauri::Env;
  5. fn main() {
  6. let mut argv = std::env::args();
  7. let argc = argv.len();
  8. if argc == 0 || argc > 2 {
  9. panic!("restart test binary expect either no arguments or `restart`.")
  10. }
  11. println!(
  12. "{}",
  13. tauri::process::current_binary(&Default::default())
  14. .expect("tauri::process::current_binary could not resolve")
  15. .display()
  16. );
  17. match argv.nth(1).as_deref() {
  18. Some("restart") => {
  19. let mut env = Env::default();
  20. env.args_os.clear();
  21. tauri::process::restart(&env)
  22. }
  23. Some(invalid) => panic!("only argument `restart` is allowed, {invalid} is invalid"),
  24. None => {}
  25. };
  26. }