instantfpc: fixed showing compiler error

git-svn-id: trunk@25340 -
This commit is contained in:
Mattias Gaertner 2013-08-23 13:47:07 +00:00
parent add4aa10df
commit 1e48781694

View File

@ -282,6 +282,15 @@ var
pid: SizeUInt; pid: SizeUInt;
BuildDir: String; BuildDir: String;
BuildOutputFilename: String; BuildOutputFilename: String;
procedure CleanUp;
begin
if BuildDir<>'' then begin
// delete build directory
DeleteDirectory(BuildDir);
end;
end;
begin begin
Compiler:=GetCompiler; Compiler:=GetCompiler;
pid:=GetProcessID; pid:=GetProcessID;
@ -307,10 +316,11 @@ begin
Halt(1); Halt(1);
end; end;
end; end;
try
CompParams:=GetCompilerParameters(CacheFilename,BuildDir,BuildOutputFilename); CompParams:=GetCompilerParameters(CacheFilename,BuildDir,BuildOutputFilename);
Proc:=TProcess.Create(nil); Proc:=TProcess.Create(nil);
Proc.CommandLine:=Compiler+' '+CompParams; Proc.CommandLine:=Compiler+' '+CompParams;
{$WARNING Unconditional use of pipes breaks for targets not supporting them} {$WARNING Unconditional use of pipes breaks for targets not supporting them}
Proc.Options:= [poUsePipes, poStdErrToOutput]; Proc.Options:= [poUsePipes, poStdErrToOutput];
Proc.ShowWindow := swoHide; Proc.ShowWindow := swoHide;
Proc.Execute; Proc.Execute;
@ -320,21 +330,23 @@ begin
if Count>0 then if Count>0 then
ss.write(buf,count); ss.write(buf,count);
until Count=0; until Count=0;
if (not Proc.WaitOnExit) or (Proc.ExitStatus<>0) then begin
WriteCompilerOutput(SrcFilename,BuildOutputFilename,ss.DataString);
CleanUp;
Halt(1);
end;
if BuildDir<>'' then begin if BuildDir<>'' then begin
// move from build directory to cache // move from build directory to cache
if not RenameFile(BuildOutputFilename,OutputFilename) then begin if not RenameFile(BuildOutputFilename,OutputFilename) then begin
writeln('unable to move "',BuildOutputFilename,'" to "',OutputFilename,'"'); writeln('unable to move "',BuildOutputFilename,'" to "',OutputFilename,'"');
Halt(1); Halt(1);
end; end;
// delete build directory
DeleteDirectory(BuildDir);
end;
if (not Proc.WaitOnExit) or (Proc.ExitStatus<>0) then begin
WriteCompilerOutput(SrcFilename,CacheFilename,ss.DataString);
Halt(1);
end; end;
ss.Free; ss.Free;
Proc.Free; Proc.Free;
finally
CleanUp;
end;
end; end;
function GetCompilerParameters(const SrcFilename, OutputDirectory, function GetCompilerParameters(const SrcFilename, OutputDirectory,