Skip to content

Commit

Permalink
installer: actually catch errors when (de-)registering the autoupdater
Browse files Browse the repository at this point in the history
The errors are printed to stderr, and we did not catch that...

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Oct 26, 2017
1 parent 9549f52 commit c5f98e0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions installer/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -1759,17 +1759,23 @@ end;
procedure InstallAutoUpdater;
var
Res:Longint;
LogPath,ErrPath:String;
begin
if not Exec(ExpandConstant('{sys}\cmd.exe'),ExpandConstant('/C schtasks /Create /F /SC DAILY /TN "Git for Windows Updater" /TR "'+#39+'{app}\git-bash.exe'+#39+' --hide --no-needs-console --command=cmd\git.exe update --gui" >"{tmp}\schedule-autoupdate.log"'),'',SW_HIDE,ewWaitUntilTerminated,Res) or (Res<>0) then
LogError(ExpandConstant('Line {#__LINE__}: Unable to schedule the Git for Windows updater (see {tmp}\schedule-autoupdate.log).'));
LogPath:=ExpandConstant('{tmp}\remove-autoupdate.log');
ErrPath:=ExpandConstant('{tmp}\remove-autoupdate.err');
if not Exec(ExpandConstant('{sys}\cmd.exe'),ExpandConstant('/C schtasks /Create /F /SC DAILY /TN "Git for Windows Updater" /TR "'+#39+'{app}\git-bash.exe'+#39+' --hide --no-needs-console --command=cmd\git.exe update --gui" >"'+LogPath+'" 2>"'+ErrPath+'"'),'',SW_HIDE,ewWaitUntilTerminated,Res) or (Res<>0) then
LogError(ExpandConstant('Line {#__LINE__}: Unable to schedule the Git for Windows updater (see "'+LogPath+'" and "'+ErrPath+'").'));
end;
procedure UninstallAutoUpdater;
var
Res:Longint;
LogPath,ErrPath:String;
begin
if not Exec(ExpandConstant('{sys}\cmd.exe'),ExpandConstant('/C schtasks /Delete /F /TN "Git for Windows Updater" >"{tmp}\remove-autoupdate.log"'),'',SW_HIDE,ewWaitUntilTerminated,Res) or (Res<>0) then
LogError(ExpandConstant('Line {#__LINE__}: Unable to remove the Git for Windows updater (see "{tmp}\remove-autoupdate.log").'));
LogPath:=ExpandConstant('{tmp}\remove-autoupdate.log');
ErrPath:=ExpandConstant('{tmp}\remove-autoupdate.err');
if not Exec(ExpandConstant('{sys}\cmd.exe'),ExpandConstant('/C schtasks /Delete /F /TN "Git for Windows Updater" >"'+LogPath+'" 2>"'+ErrPath+'"'),'',SW_HIDE,ewWaitUntilTerminated,Res) or (Res<>0) then
LogError(ExpandConstant('Line {#__LINE__}: Unable to remove the Git for Windows updater (see "'+LogPath+'" and "'+ErrPath+'").'));
end;
procedure CurStepChanged(CurStep:TSetupStep);
Expand Down

0 comments on commit c5f98e0

Please sign in to comment.