diff options
| -rw-r--r-- | dist-assets/windows/installer.nsh | 8 | ||||
| -rw-r--r-- | mullvad-setup/src/main.rs | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh index 1e0d8766da..4cf4985362 100644 --- a/dist-assets/windows/installer.nsh +++ b/dist-assets/windows/installer.nsh @@ -46,6 +46,7 @@ !define MVSETUP_OK 0 !define MVSETUP_ERROR 1 !define MVSETUP_VERSION_NOT_OLDER 2 +!define MVSETUP_DAEMON_NOT_RUNNING 3 # Override electron-builder generated application settings key. # electron-builder uses a GUID here rather than the application name. @@ -916,7 +917,12 @@ Pop $0 Pop $1 - # Ignore any errors -- the command will fail if the daemon is not running + ${If} $0 != ${MVSETUP_OK} + ${AndIf} $0 != ${MVSETUP_DAEMON_NOT_RUNNING} + StrCpy $R0 "Failed to send prepare-restart to service" + log::LogWithDetails $R0 $1 + Goto customRemoveFiles_abort + ${EndIf} ${EndIf} ${StopAndDeleteService} diff --git a/mullvad-setup/src/main.rs b/mullvad-setup/src/main.rs index 0e9c104db1..45186dd1a7 100644 --- a/mullvad-setup/src/main.rs +++ b/mullvad-setup/src/main.rs @@ -19,6 +19,16 @@ enum ExitStatus { Ok = 0, Error = 1, VersionNotOlder = 2, + DaemonNotRunning = 3, +} + +impl From<Error> for ExitStatus { + fn from(error: Error) -> ExitStatus { + match error { + Error::RpcConnectionError(_) => ExitStatus::DaemonNotRunning, + _ => ExitStatus::Error, + } + } } #[cfg(windows)] @@ -112,7 +122,7 @@ async fn main() { if let Err(e) = result { eprintln!("{}", e.display_chain()); - process::exit(ExitStatus::Error as i32); + process::exit(ExitStatus::from(e) as i32); } } |
