You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: restart.rs
    path of file: ./repos/tauri/core/tests/restart/tests
    
    the code of the file until where you have to start completion: // Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;

/// Helper for generic catch-all errors.
type Result = std::result::Result<(), Box<dyn std::error::Error>>;

/// https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--1300-1699-
#[cfg(windows)]
const ERROR_PRIVILEGE_NOT_HELD: i32 = 1314;

/// Represents a successfully created symlink.
enum Symlink {
  /// Path to the created symlink
  Created(PathBuf),

  /// A symlink that failed due to missing permissions (Windows).
  #[allow(dead_code)]
  Privilege,
}

/// Compile the test binary, run it, and compare it with expected output.
///
/// Failing to create a symlink due to permissions issues is also a success
/// for the purpos
    
fn symlink_runner(create_symlinks: impl Fn(&Path) -> io::Result<Symlink>) -> Result {
  let mut compiled_binary = PathBuf::from(env!("OUT_DIR")).join("../../../restart");
  if cfg!(windows) {
    compiled_binary.set_extension("exe");
  }
  println!("{compiled_binary:?}");

  // set up all the temporary file paths
  let temp = tempfile::TempDir::new()?;
  let bin = temp.path().canonicalize()?.join("restart.exe");

  // copy the built restart test binary to our temporary directory
  std::fs::copy(compiled_binary, &bin)?;

  if let Symlink::Created(link) = create_symlinks(&bin)? {
    // run the command from the symlink, so that we can test if restart resolves it correctly
    let mut cmd = Command::new(link);

    // add the restart parameter so that the invocation will call tauri::process::restart
    cmd.arg("restart");

    let output = cmd.output()?;

    // run `TempDir` destructors to prevent resource leaking if the assertion fails
    drop(temp);

    if output.status.success() {
      // gather the output into a string
      let stdout = String::from_utf8(output.stdout)?;

      // we expect the output to be the bin path, twice
      assert_eq!(stdout, format!("{bin}\n{bin}\n", bin = bin.display()));
    } else if cfg!(all(
      target_os = "macos",
      not(feature = "process-relaunch-dangerous-allow-symlink-macos")
    )) {
      // we expect this to fail on macOS without the dangerous symlink flag set
      let stderr = String::from_utf8(output.stderr)?;

      // make sure it's the error that we expect
      assert!(stderr.contains(
        "StartingBinary found current_exe() that contains a symlink on a non-allowed platform"
      ));
    } else {
      // we didn't expect the program to fail in this configuration, just panic
      panic!("restart integration test runner failed for unknown reason");
    }
  }

  Ok(())
}