mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 07:49:10 +02:00
Add some delay and a maximum attempt number in GenerateTempDir to avoid getting oversized execution log files
This commit is contained in:
parent
550d0481b3
commit
52cc8df079
@ -30,14 +30,19 @@ var
|
|||||||
TmpFileList : TStringList;
|
TmpFileList : TStringList;
|
||||||
|
|
||||||
function GenerateTempDir: string;
|
function GenerateTempDir: string;
|
||||||
|
const
|
||||||
|
max_attempts = 10;
|
||||||
var
|
var
|
||||||
TempDirName: string;
|
TempDirName: string;
|
||||||
BaseTempDir: string;
|
BaseTempDir: string;
|
||||||
Done: Boolean = False;
|
Done: Boolean = False;
|
||||||
|
attempt: longint;
|
||||||
begin
|
begin
|
||||||
BaseTempDir := GetTempDir(False);
|
BaseTempDir := GetTempDir(False);
|
||||||
Result := no_temp_dir_generated;
|
Result := no_temp_dir_generated;
|
||||||
|
attempt := 0;
|
||||||
repeat
|
repeat
|
||||||
|
inc(attempt);
|
||||||
try
|
try
|
||||||
TempDirName := BaseTempDir + 'dosboxwrappertmp_' + IntToStr(Random(100000));
|
TempDirName := BaseTempDir + 'dosboxwrappertmp_' + IntToStr(Random(100000));
|
||||||
if verbose then
|
if verbose then
|
||||||
@ -56,8 +61,13 @@ begin
|
|||||||
raise;
|
raise;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
on E: Exception do
|
||||||
|
begin
|
||||||
|
Writeln('Exception ',E.Message);
|
||||||
|
Sleep(1000);
|
||||||
end;
|
end;
|
||||||
until Done;
|
end;
|
||||||
|
until Done or (attempt > max_attempts);
|
||||||
Result := TempDirName + DirectorySeparator;
|
Result := TempDirName + DirectorySeparator;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user