Nothing was changed.
Can you please give some sample code? It's hard to say something in general.
Note that > or | cannot be used unless you invoke the shell with a
commandline like
/bin/sh -c "your command > yourfile"
I mean when I launch the program myself on the commandline e.g.
./hawkstoneadmin | grep "INSERT INTO"
So the piping should, in theory, have no effect on this call:
function GetCanID:String
Var StrList: TStringList;
Begin
execute ('/usr/bin/getcanid.sh',StrList)
try
GetCanID = StrList[0];
except
GetCanID = 'UNSET';
end;
The execute procedure is defined as follows:
procedure execute (command:string; var output:Tstrings);
const
READ_BYTES = 2048;
Var
Process :Tprocess;
MemStream : TMemoryStream;
n: LongInt;
BytesRead: LongInt;
begin
try
Process := TProcess.create(nil);;
Process.CommandLine := command;
{Actually run the thing and catch the output}
MemStream := TMemoryStream.Create;
outPut := TStringList.Create;
BytesRead := 0;
Process.Options := [poUsePipes,poNoConsole];
Process.Execute;
while Process.Running do
begin
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);
// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n > 0
then begin
Inc(BytesRead, n);
end
else begin
// no data, wait 100 ms
Sleep(100);
end;
end;
// read last part
repeat
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);
// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n > 0
then begin
Inc(BytesRead, n);
end;
until n <= 0;
MemStream.SetSize(BytesRead);
OutPut.LoadFromStream(MemStream);
MemStream.Free;
Process.Free;
except
debugln('Could not execute: '+Command);
end;
end;
--
"Any sufficiently advanced technology is indistinguishable from magic" -
Clarke's law
"Any technology that is distinguishable from magic is insufficiently
advanced" -Gehm's corollary
"Any technologist that is distinguishable from a magician is
insufficiently advanced" - My corollary
The worlds worst webcomic: http://silentcoder.co.za/scartoonz
The worlds best cybercafe manager: http://outkafe.outkastsolutions.co.za
begin:vcard
fn:AJ Venter
n:Venter;AJ
org:Global Pact Trading Pty. Ltd.;OutKast Solutions
email;internet:[EMAIL PROTECTED]
title:Director of Product Development
tel;work:+27 21 554 5059
tel;fax:+27 11 252 9197
tel;cell:+27 83 455 9978
url:http://www.outkastsolutions.co.za
version:2.1
end:vcard