[fpc-pascal] Is there some example of an FPC program for use in svn hook calls (email)?
Bo Berglund
bo.berglund at gmail.com
Thu Dec 14 19:54:49 CET 2017
On Thu, 14 Dec 2017 19:37:55 +0100 (CET),
marcov at stack.nl (Marco van de Voort) wrote:
>In our previous episode, Bo Berglund said:
>> But *sending email* is not the problem, I have done this in many
>> applications using Indy TIdSMTP. Instead it is getting data out oof
>> svn and formatting these in a friendly looking email to be sent....
>
>Actually process.runcommand was developed to get the output of SVN commands.
>
>It is used to create the mergelogs http://www.stack.nl/~marcov/mergelogs26/
Thanks for your suggestion!
Do you mean replace the current code:
AProcess.Executable := Command;
AProcess.Options := [poUsePipes];
for i := 0 to Parameters.Count -1 do
AProcess.Parameters.Add(Parameters[i]);
AProcess.Execute;
repeat
BytesRead := AProcess.Output.Read(Buffer, BUF_SIZE);
OutputStream.Write(Buffer, BytesRead);
until BytesRead = 0; // Stop if no more data is available
OutputStream.Position := 0;
SvnData.LoadFromStream(OutputStream);
With something like this:
if AProcess.RunCommand(Command, Parameters.Strings, sTmp) then
begin
SvnData.Text := sTmp);
Result := true;
end;
Are all of those preliminaries unnecessary and could be discarded
then?
BTW:
How can I view what is actually happening in the command window when
debugging the code?
When I started this (in Lazarus 1.6) I selected a new "Program" rather
than a "Console application".
--
Bo Berglund
Developer in Sweden
More information about the fpc-pascal
mailing list