mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 15:49:26 +02:00
* Add demo for RunCommand
git-svn-id: trunk@32892 -
This commit is contained in:
parent
622ffb9a65
commit
f1ef3f330a
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -2579,6 +2579,8 @@ 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/demoruncommand.lpi svneol=native#text/plain
|
||||
packages/fcl-process/examples/demoruncommand.pp svneol=native#text/plain
|
||||
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
|
||||
|
64
packages/fcl-process/examples/demoruncommand.lpi
Normal file
64
packages/fcl-process/examples/demoruncommand.lpi
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="demoruncommand"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="demoruncommand.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
</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>
|
23
packages/fcl-process/examples/demoruncommand.pp
Normal file
23
packages/fcl-process/examples/demoruncommand.pp
Normal file
@ -0,0 +1,23 @@
|
||||
{$mode objfpc}
|
||||
{$h+}
|
||||
|
||||
program demoruncommand;
|
||||
{
|
||||
Demonstrate the RunCommand program.
|
||||
|
||||
Before running this demo program, compile the echoparams program first,
|
||||
make sure both binaries are in the same directory.
|
||||
}
|
||||
|
||||
uses sysutils, process;
|
||||
|
||||
Var
|
||||
S : String;
|
||||
|
||||
begin
|
||||
if RunCommand(ExtractFilePath(ParamStr(0))+'echoparams',['a','b','c'],S,[]) then
|
||||
Writeln('echoparams returned : ',S)
|
||||
else
|
||||
Writeln('Command failed');
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user