Browse Source

* Add demo for RunCommand

git-svn-id: trunk@32892 -
michael 9 years ago
parent
commit
f1ef3f330a

+ 2 - 0
.gitattributes

@@ -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.lpi svneol=native#text/plain
 packages/fcl-process/examples/demoproject.pp 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/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/examples/echoparams.pp svneol=native#text/plain
 packages/fcl-process/fpmake.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/pipes.inc svneol=native#text/plain

+ 64 - 0
packages/fcl-process/examples/demoruncommand.lpi

@@ -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 - 0
packages/fcl-process/examples/demoruncommand.pp

@@ -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.
+