Op 2020-04-01 om 09:59 schreef Gabor Boros:
Show quoted text 8 lines
I found out the problem. TProcess was modified for long running processes to not consume too much CPU.
I think I'll put this under a special porunidle option in trunk and fpc 3.2.0 , so to only trigger this when needed.
But at least FPC3.2.0rc1 has a rewritten tprocess/runcommand that makes this fixable without source changes and recompilation, look at the next example:
{$mode delphi}
uses classes,sysutils,process;
type
TNoSleepProcess = class(TProcess)
constructor Create (AOwner : TComponent);override;
end;
constructor TNoSleepProcess.Create (AOwner : TComponent);
begin
inherited;
RunCommandSleepTime:=0; // rest the default sleep time to 0 (context
switch only)
end;
var
Start:TDateTime;
OS:String;
begin
DefaultTProcess:=TNoSleepProcess; // set as system wide (!) tprocess
class for runcommand() variants
Start:=Now;
RunCommandInDir('d:\FPC\3.0.4\bin\i386-win32','fpc.exe',['-h'],OS,[poUsePipes]);
WriteLn(FormatDateTime('nn:ss.zzz',Now-Start));
end.