Skip to content

Commit ff1e03f

Browse files
committed
pass -silent and -log options when re-launching the uninstaller (fixes #1538)
1 parent 84fcc4f commit ff1e03f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/Uninstaller.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static WCHAR* GetUninstallerPathInTemp() {
526526

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

552552
// TODO: should extract cmd-line from GetCommandLineW() by skipping the first
553553
// item, which is path to the executable
554-
WCHAR* cmdLine = L"-uninstall";
555-
logf(L"Re-launching '%s' with args '%s' as elevated\n", installerTempPath.Get(), cmdLine);
556-
LaunchElevated(installerTempPath, cmdLine);
554+
555+
str::WStr cmdLine = L"-uninstall";
556+
if (cli->silent) {
557+
cmdLine.Append(L" -silent");
558+
}
559+
if (cli->log) {
560+
cmdLine.Append(L" -log");
561+
}
562+
logf(L"Re-launching '%s' with args '%s' as elevated\n", installerTempPath.Get(), cmdLine.Get());
563+
LaunchElevated(installerTempPath, cmdLine.Get());
557564
::ExitProcess(0);
558565
}
559566

@@ -623,7 +630,7 @@ int RunUninstaller(Flags* cli) {
623630
goto Exit;
624631
}
625632

626-
RelaunchElevatedFromTempDirectory();
633+
RelaunchElevatedFromTempDirectory(cli);
627634

628635
if (gIsRaMicroBuild) {
629636
return RunUninstallerRaMicro();

0 commit comments

Comments
 (0)