[Lazarus] How to add & change application EnvironmentList ?
FreeMan
freeman35 at delphiturkiye.com
Wed Aug 26 18:59:58 CEST 2015
On 26.08.2015 18:35, Michael Van Canneyt wrote:
> AProcess.Environment must be used for this.
>
> Michael.
Sorry, I didn't understand what you mean.
This is my test code, before and after execute, write all environment
variables in memo1, but same variables. Tprocess class similar not working.
if Assigned(AProcess)then FreeAndNil(AProcess);
AProcess := TProcess.Create(Application);
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
Form1.Memo1.Clear;
for I := 1 to GetEnvironmentVariableCount do begin
AProcess.Environment.Add(GetEnvironmentString(I));
Form1.Memo1.Lines.Add(GetEnvironmentString(I));
end;
Form1.Memo1.Lines.Add('');
Form1.Memo1.Lines.Add('-------------------------------');
Form1.Memo1.Lines.Add('--------------------');
Form1.Memo1.Lines.Add('');
AProcess.Executable := '/bin/sh';
AProcess.Parameters.Text := 'export LD_LIBRARY_PATH=' + fb_RootPath;
AProcess.Execute;
Form1.Memo1.Lines.LoadFromStream(AProcess.Output); // -->>
outpu is empty
for I := 1 to GetEnvironmentVariableCount do
Form1.Memo1.Lines.Add(GetEnvironmentString(I));
More information about the Lazarus
mailing list