mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 10:19:30 +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;
|
||||
|
||||
function GenerateTempDir: string;
|
||||
const
|
||||
max_attempts = 10;
|
||||
var
|
||||
TempDirName: string;
|
||||
BaseTempDir: string;
|
||||
Done: Boolean = False;
|
||||
attempt: longint;
|
||||
begin
|
||||
BaseTempDir := GetTempDir(False);
|
||||
Result := no_temp_dir_generated;
|
||||
attempt := 0;
|
||||
repeat
|
||||
inc(attempt);
|
||||
try
|
||||
TempDirName := BaseTempDir + 'dosboxwrappertmp_' + IntToStr(Random(100000));
|
||||
if verbose then
|
||||
@ -56,8 +61,13 @@ begin
|
||||
raise;
|
||||
end;
|
||||
end;
|
||||
on E: Exception do
|
||||
begin
|
||||
Writeln('Exception ',E.Message);
|
||||
Sleep(1000);
|
||||
end;
|
||||
end;
|
||||
until Done;
|
||||
until Done or (attempt > max_attempts);
|
||||
Result := TempDirName + DirectorySeparator;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user