kopia lustrzana https://github.com/OpenDroneMap/ODM
Handle CTRL+C
rodzic
e2324e27ba
commit
079b80dbe0
|
@ -87,4 +87,65 @@ begin
|
||||||
begin
|
begin
|
||||||
ExtractTemporaryFile('vc_redist.x64.exe');
|
ExtractTemporaryFile('vc_redist.x64.exe');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetUninstallString(): String;
|
||||||
|
var
|
||||||
|
sUnInstPath: String;
|
||||||
|
sUnInstallString: String;
|
||||||
|
begin
|
||||||
|
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
|
||||||
|
sUnInstallString := '';
|
||||||
|
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
|
||||||
|
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
|
||||||
|
Result := sUnInstallString;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function IsUpgrade(): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (GetUninstallString() <> '');
|
||||||
|
end;
|
||||||
|
|
||||||
|
function UnInstallOldVersion(): Integer;
|
||||||
|
var
|
||||||
|
sUnInstallString: String;
|
||||||
|
iResultCode: Integer;
|
||||||
|
begin
|
||||||
|
{ Return Values: }
|
||||||
|
{ 1 - uninstall string is empty }
|
||||||
|
{ 2 - error executing the UnInstallString }
|
||||||
|
{ 3 - successfully executed the UnInstallString }
|
||||||
|
|
||||||
|
{ default return value }
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
{ get the uninstall string of the old app }
|
||||||
|
sUnInstallString := GetUninstallString();
|
||||||
|
if sUnInstallString <> '' then begin
|
||||||
|
sUnInstallString := RemoveQuotes(sUnInstallString);
|
||||||
|
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
|
||||||
|
Result := 3
|
||||||
|
else
|
||||||
|
Result := 2;
|
||||||
|
end else
|
||||||
|
Result := 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CurStepChanged(CurStep: TSetupStep);
|
||||||
|
begin
|
||||||
|
if (CurStep=ssInstall) then
|
||||||
|
begin
|
||||||
|
if (IsUpgrade()) then
|
||||||
|
begin
|
||||||
|
UnInstallOldVersion();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
[UninstallDelete]
|
||||||
|
Type: filesandordirs; Name: "{app}\SuperBuild"
|
||||||
|
Type: filesandordirs; Name: "{app}\contrib"
|
||||||
|
Type: filesandordirs; Name: "{app}\licenses"
|
||||||
|
Type: filesandordirs; Name: "{app}\opendm"
|
||||||
|
Type: filesandordirs; Name: "{app}\stages"
|
||||||
|
Type: filesandordirs; Name: "{app}\venv"
|
||||||
|
|
|
@ -47,7 +47,10 @@ def exit_gracefully():
|
||||||
|
|
||||||
for sp in running_subprocesses:
|
for sp in running_subprocesses:
|
||||||
log.ODM_WARNING("Sending TERM signal to PID %s..." % sp.pid)
|
log.ODM_WARNING("Sending TERM signal to PID %s..." % sp.pid)
|
||||||
os.killpg(os.getpgid(sp.pid), signal.SIGTERM)
|
if sys.platform == 'win32':
|
||||||
|
os.kill(sp.pid, signal.CTRL_C_EVENT)
|
||||||
|
else:
|
||||||
|
os.killpg(os.getpgid(sp.pid), signal.SIGTERM)
|
||||||
|
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue