Skip to content

Commit a9fbfc8

Browse files
committed
Adding try catch to make the uninstall able to uninstall a broken installment.
1 parent c47a0d7 commit a9fbfc8

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

eFormAPI/Installation/CustomActions/CustomAction.cs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,24 @@ public static ActionResult RemoveCA(Session session)
546546
// stop sites
547547
ControlSites(customerNumber, domain, apiPort, uiPort, false);
548548
IncrementProgressBar(session);
549-
RemoveSites(customerNumber, domain, apiPort, uiPort);
549+
try {
550+
RemoveSites(customerNumber, domain, apiPort, uiPort);
551+
} catch { }
552+
550553
IncrementProgressBar(session);
551-
552-
RunProcess(@"sc", $"stop eformangular{uiName.Replace(".", "")}.exe");
554+
try
555+
{
556+
RunProcess(@"sc", $"stop eformangular{uiName.Replace(".", "")}.exe");
557+
} catch { }
553558
Thread.Sleep(1000);
554-
RunProcess(@"C:\Program Files\nodejs\node.exe", "svc.js uninstall", uiIisDir);
555-
RunProcess(@"sc", $"delete eformangular{uiName.Replace(".", "")}.exe");
559+
try
560+
{
561+
RunProcess(@"C:\Program Files\nodejs\node.exe", "svc.js uninstall", uiIisDir);
562+
} catch { }
563+
try
564+
{
565+
RunProcess(@"sc", $"delete eformangular{uiName.Replace(".", "")}.exe");
566+
} catch { }
556567
IncrementProgressBar(session);
557568

558569
var keepSettings = session.CustomActionData["KEEPSETTINGS"] == "1";
@@ -567,9 +578,15 @@ public static ActionResult RemoveCA(Session session)
567578
.Replace("eform-client\\", "")).ToArray()
568579
: new string[0];
569580

570-
DeleteDirectory(uiIisDir, keepFolders, keepFiles, uiIisDir);
581+
try
582+
{
583+
DeleteDirectory(uiIisDir, keepFolders, keepFiles, uiIisDir);
584+
} catch { }
571585
IncrementProgressBar(session);
572-
DeleteDirectory(webApiIisDir, keepFolders, keepFiles, webApiIisDir);
586+
try
587+
{
588+
DeleteDirectory(webApiIisDir, keepFolders, keepFiles, webApiIisDir);
589+
} catch { }
573590
IncrementProgressBar(session);
574591

575592
var vendorName = "Microting";

0 commit comments

Comments
 (0)