I answered my own question... python uses popen (c varients cross platform) and free pascal uses a different method... This is modified from the wiki to execute a program (and is free pascal only)..
Code:
// This is a demo program that shows how to launch
// an external program.
// program launchprogram;
unit launchprogram;
interface
procedure runprogram(name :string);
// Here we include files that have useful functions
// and procedures we will need.
// uses
// Classes, SysUtils, Process;
// This is defining the var "AProcess" as a variable
// of the type "TProcess"
//var
// AProcess: TProcess;
implementation
uses
Classes, SysUtils, Process;
// This is where our program starts to run
procedure runprogram(name :string);
var
AProcess: TProcess;
begin;
// Now we will create the TProcess object, and
// assign it to the var AProcess.
AProcess := TProcess.Create(nil);
// Tell the new AProcess what the command to execute is.
// Let's use the FreePascal compiler
AProcess.CommandLine := name; //'ppc386 -h';
// We will define an option for when the program
// is run. This option will make sure that our program
// does not continue until the program we will launch
// has stopped running. vvvvvvvvvvvvvv
AProcess.Options := AProcess.Options + [poWaitOnExit];
// Now that AProcess knows what the commandline is
// we will run it.
AProcess.Execute;
// This is not reached until ppc386 stops running.
AProcess.Free;
end;
end.
Bookmarks