* Added some example program for TProcess

git-svn-id: trunk@32891 -
This commit is contained in:
michael 2016-01-08 20:59:30 +00:00
parent ef9504ffd7
commit 622ffb9a65
6 changed files with 120 additions and 0 deletions

5
.gitattributes vendored
View File

@ -2575,6 +2575,11 @@ packages/fcl-passrc/tests/testpassrc.lpr svneol=native#text/plain
packages/fcl-process/Makefile svneol=native#text/plain
packages/fcl-process/Makefile.fpc svneol=native#text/plain
packages/fcl-process/Makefile.fpc.fpcmake svneol=native#text/plain
packages/fcl-process/examples/demoproject.ico -text
packages/fcl-process/examples/demoproject.lpi svneol=native#text/plain
packages/fcl-process/examples/demoproject.pp svneol=native#text/plain
packages/fcl-process/examples/demoproject.res -text
packages/fcl-process/examples/echoparams.pp svneol=native#text/plain
packages/fcl-process/fpmake.pp svneol=native#text/plain
packages/fcl-process/src/amicommon/pipes.inc svneol=native#text/plain
packages/fcl-process/src/amicommon/process.inc svneol=native#text/plain

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="demoproject"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="2">
<Unit0>
<Filename Value="demoproject.pp"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../src/process.pp"/>
<IsPartOfProject Value="True"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<SearchPaths>
<IncludeFiles Value="../src;../src/unix;$(ProjOutDir)"/>
<OtherUnitFiles Value="../src"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,33 @@
program demoproject;
{$mode objfpc}{$H+}
uses
sysutils, process;
{$R *.res}
Var
I : integer;
begin
if ParamCount<>0 then
begin
Writeln('This is executable: "',ParamStr(0),'"');
Writeln('Got parameters:');
For I:=1 to 10 do
Writeln('"',ParamStr(I),'"');
end
else
With TProcess.Create(Nil) do
try
Executable:=ParamStr(0);
Writeln(Format('Starting executable: "%s"',[Executable]));
For I:=1 to 10 do
Parameters.Add('Parameter '+IntToStr(I));
Execute;
finally
Free;
end;
end.

Binary file not shown.

View File

@ -0,0 +1,9 @@
program echoparams;
var
I : Integer;
begin
For I:=0 to ParamCount do
Writeln(I:2,' : "',Paramstr(i),'"');
end.