summaryrefslogtreecommitdiffhomepage
path: root/test/test-runner/src/sys.rs
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-04-08 10:50:43 +0200
committerSebastian Holmin <sebastian.holmin@mullvad.net>2024-04-09 11:03:32 +0200
commit8eea4eae01061fb76ce1aac45ea296f60867b62c (patch)
tree09455ab30579abdf1b30b9038a7626f6d280fc11 /test/test-runner/src/sys.rs
parent88bba34062f1efccafa52578d56601a97f8e5e2b (diff)
downloadmullvadvpn-8eea4eae01061fb76ce1aac45ea296f60867b62c.tar.xz
mullvadvpn-8eea4eae01061fb76ce1aac45ea296f60867b62c.zip
Run `cargo +nightly fmt`
Diffstat (limited to 'test/test-runner/src/sys.rs')
-rw-r--r--test/test-runner/src/sys.rs39
1 files changed, 19 insertions, 20 deletions
diff --git a/test/test-runner/src/sys.rs b/test/test-runner/src/sys.rs
index 7576c64e89..5015f26ca1 100644
--- a/test/test-runner/src/sys.rs
+++ b/test/test-runner/src/sys.rs
@@ -1,8 +1,7 @@
use std::collections::HashMap;
#[cfg(target_os = "windows")]
use std::io;
-use test_rpc::meta::OsVersion;
-use test_rpc::mullvad_daemon::Verbosity;
+use test_rpc::{meta::OsVersion, mullvad_daemon::Verbosity};
#[cfg(target_os = "windows")]
use std::ffi::OsString;
@@ -14,11 +13,13 @@ use windows_service::{
#[cfg(target_os = "windows")]
pub fn reboot() -> Result<(), test_rpc::Error> {
- use windows_sys::Win32::System::Shutdown::{
- ExitWindowsEx, EWX_REBOOT, SHTDN_REASON_FLAG_PLANNED, SHTDN_REASON_MAJOR_APPLICATION,
- SHTDN_REASON_MINOR_OTHER,
+ use windows_sys::Win32::{
+ System::Shutdown::{
+ ExitWindowsEx, EWX_REBOOT, SHTDN_REASON_FLAG_PLANNED, SHTDN_REASON_MAJOR_APPLICATION,
+ SHTDN_REASON_MINOR_OTHER,
+ },
+ UI::WindowsAndMessaging::EWX_FORCEIFHUNG,
};
- use windows_sys::Win32::UI::WindowsAndMessaging::EWX_FORCEIFHUNG;
grant_shutdown_privilege()?;
@@ -52,18 +53,17 @@ pub fn reboot() -> Result<(), test_rpc::Error> {
#[cfg(target_os = "windows")]
fn grant_shutdown_privilege() -> Result<(), test_rpc::Error> {
- use windows_sys::Win32::Foundation::CloseHandle;
- use windows_sys::Win32::Foundation::HANDLE;
- use windows_sys::Win32::Foundation::LUID;
- use windows_sys::Win32::Security::AdjustTokenPrivileges;
- use windows_sys::Win32::Security::LookupPrivilegeValueW;
- use windows_sys::Win32::Security::LUID_AND_ATTRIBUTES;
- use windows_sys::Win32::Security::SE_PRIVILEGE_ENABLED;
- use windows_sys::Win32::Security::TOKEN_ADJUST_PRIVILEGES;
- use windows_sys::Win32::Security::TOKEN_PRIVILEGES;
- use windows_sys::Win32::System::SystemServices::SE_SHUTDOWN_NAME;
- use windows_sys::Win32::System::Threading::GetCurrentProcess;
- use windows_sys::Win32::System::Threading::OpenProcessToken;
+ use windows_sys::Win32::{
+ Foundation::{CloseHandle, HANDLE, LUID},
+ Security::{
+ AdjustTokenPrivileges, LookupPrivilegeValueW, LUID_AND_ATTRIBUTES,
+ SE_PRIVILEGE_ENABLED, TOKEN_ADJUST_PRIVILEGES, TOKEN_PRIVILEGES,
+ },
+ System::{
+ SystemServices::SE_SHUTDOWN_NAME,
+ Threading::{GetCurrentProcess, OpenProcessToken},
+ },
+ };
let mut privileges = TOKEN_PRIVILEGES {
PrivilegeCount: 1,
@@ -458,8 +458,7 @@ pub async fn set_daemon_environment(env: HashMap<String, String>) -> Result<(),
#[cfg(target_os = "windows")]
pub fn get_system_path_var() -> Result<String, test_rpc::Error> {
- use winreg::enums::*;
- use winreg::*;
+ use winreg::{enums::*, *};
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
let key = hklm