Implement respawn after upgrade in Windows

This commit is contained in:
Roey Darwish Dror
2019-06-03 09:41:25 +03:00
parent 693935816a
commit 50a0563bb4
4 changed files with 52 additions and 12 deletions

View File

@@ -44,6 +44,10 @@ pub enum ErrorKind {
#[fail(display = "A step should be skipped")]
SkipStep,
#[cfg(all(windows, feature = "self-update"))]
#[fail(display = "Topgrade Upgraded")]
Upgraded(ExitStatus),
}
impl Fail for Error {
@@ -66,6 +70,15 @@ impl Error {
pub fn kind(&self) -> ErrorKind {
*self.inner.get_context()
}
#[cfg(all(windows, feature = "self-update"))]
pub fn upgraded(&self) -> bool {
if let ErrorKind::Upgraded(_) = self.kind() {
true
} else {
false
}
}
}
impl From<ErrorKind> for Error {