Skip to content

Commit

Permalink
pass -silent and -log options when re-launching the uninstaller (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Apr 3, 2020
1 parent 84fcc4f commit ff1e03f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Uninstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ static WCHAR* GetUninstallerPathInTemp() {

// to be able to delete installation directory we must copy
// ourselves to temp directory and re-launch
static void RelaunchElevatedFromTempDirectory() {
static void RelaunchElevatedFromTempDirectory(Flags* cli) {
if (gIsDebugBuild) {
// for easier debugging, debug build doesn't need
// to be copied / re-launched
Expand All @@ -551,9 +551,16 @@ static void RelaunchElevatedFromTempDirectory() {

// TODO: should extract cmd-line from GetCommandLineW() by skipping the first
// item, which is path to the executable
WCHAR* cmdLine = L"-uninstall";
logf(L"Re-launching '%s' with args '%s' as elevated\n", installerTempPath.Get(), cmdLine);
LaunchElevated(installerTempPath, cmdLine);

str::WStr cmdLine = L"-uninstall";
if (cli->silent) {
cmdLine.Append(L" -silent");
}
if (cli->log) {
cmdLine.Append(L" -log");
}
logf(L"Re-launching '%s' with args '%s' as elevated\n", installerTempPath.Get(), cmdLine.Get());
LaunchElevated(installerTempPath, cmdLine.Get());
::ExitProcess(0);
}

Expand Down Expand Up @@ -623,7 +630,7 @@ int RunUninstaller(Flags* cli) {
goto Exit;
}

RelaunchElevatedFromTempDirectory();
RelaunchElevatedFromTempDirectory(cli);

if (gIsRaMicroBuild) {
return RunUninstallerRaMicro();
Expand Down

0 comments on commit ff1e03f

Please sign in to comment.