ADD: MultiArc - check exitstatus on list parsing (#1936)

This commit is contained in:
j2969719 2024-11-04 22:08:15 +03:00 committed by GitHub
commit fd70dbe29a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 4 deletions

View file

@ -292,7 +292,7 @@ begin
Result:= False;
ShowError(Format(rsMsgLogError + rsMsgLogPack,
[FileName +
' - Exit status: ' + IntToStr(ExitStatus)]), [log_arc_op]);
' - ' + rsMsgExitStatusCode + ' ' + IntToStr(ExitStatus)]), [log_arc_op]);
end
else
begin

View file

@ -672,7 +672,7 @@ begin
ShowError(Format(rsMsgLogError + rsMsgLogExtract,
[FMultiArchiveFileSource.ArchiveFileName + PathDelim +
SourceName + ' -> ' + TargetName +
' - Exit status: ' + IntToStr(ExitStatus)]), [log_arc_op]);
' - ' + rsMsgExitStatusCode + ' ' + IntToStr(ExitStatus)]), [log_arc_op]);
end // Error
else
begin

View file

@ -199,7 +199,7 @@ begin
begin
ShowError(Format(rsMsgLogError + rsMsgLogDelete,
[FileName +
' - Exit status: ' + IntToStr(ExitStatus)]), [log_arc_op]);
' - ' + rsMsgExitStatusCode + ' ' + IntToStr(ExitStatus)]), [log_arc_op]);
end
else
begin

View file

@ -126,7 +126,7 @@ implementation
uses
uDebug, uGlobs, DCFileAttributes, DCOSUtils, DCStrUtils, DCDateTimeUtils,
FileUtil, uMasks,
FileUtil, uMasks, uLng,
uMultiArchiveListOperation,
uMultiArchiveCopyInOperation,
uMultiArchiveCopyOutOperation,
@ -606,6 +606,9 @@ begin
FOutputParser.Execute;
FPassword:= FOutputParser.Password;
if FOutputParser.OpenError and (AFileList.Count < 1) then
raise EFileSourceException.Create(rsMsgErrEOpen);
(* if archiver does not give a list of folders *)
for I := 0 to FAllDirsList.Count - 1 do
begin

View file

@ -17,6 +17,8 @@ type
FExProcess: TExProcess;
FMultiArcItem: TMultiArcItem;
FParser: TMultiArchiveParser;
FErrorLevel: LongInt;
FOpenError: Boolean;
FConvertEncoding: function (const Source: String): RawByteString;
private
FArchiveName: String;
@ -35,6 +37,7 @@ type
procedure Prepare;
procedure Execute;
property OpenError: Boolean read FOpenError;
property Password: String read FPassword write FPassword;
property OnGetArchiveItem: TOnGetArchiveItem write SetOnGetArchiveItem;
end;
@ -68,6 +71,7 @@ var
Index: Integer;
begin
Result:= FMultiArcItem.FList;
FErrorLevel:= ExtractErrorLevel(Result);
Index:= Pos('%O', Result);
FConvertEncoding:= @DCOSUtils.ConsoleToUTF8;
if (Index > 0) and (Index + 2 <= Length(Result)) then
@ -87,6 +91,7 @@ end;
procedure TOutputParser.OnProcessExit;
begin
FOpenError:= (FExProcess.ExitStatus > FErrorLevel);
FParser.ParseLines;
end;
@ -190,6 +195,7 @@ begin
sCommandLine:= FormatArchiverCommand(FMultiArcItem.FArchiver,
sCommandLine, FArchiveName,
nil, '', '','', FPassword);
if FMultiArcItem.FDebug then
DCDebug(sCommandLine);