[Lazarus] SetEnv on Linux 64bit

fred f ffred69 at gmail.com
Tue Apr 3 17:04:45 CEST 2012


Hi guys,

I try to start itself again with this code, but it doesn't work:

  IF GetEnvironmentVariable('LIBOVERLAY_SCROLLBAR') <> '0' THEN begin
    mProc := TProcess.Create(NIL);
    mProc.CommandLine := GetExeName;
    mProc.Environment.Add('LIBOVERLAY_SCROLLBAR=0');
    mProc.Environment.Add('UBUNTU_MENUPROXY=');
    mProc.Options := mProc.Options + [poNoConsole];
    mProc.Execute;
    mProc.Free;

    halt; //close itself
  END;

What's wrong with this code?

Tnx, f.


On Tue, Apr 3, 2012 at 4:30 PM,  <michael.vancanneyt at wisa.be> wrote:
>
>
> On Tue, 3 Apr 2012, Marco van de Voort wrote:
>
>> On Tue, Apr 03, 2012 at 03:57:01PM +0200, michael.vancanneyt at wisa.be
>> wrote:
>>>>
>>>> supported and therefore I am looking for SetEnv which I can use on 64bit
>>>> Linux.
>>>>
>>>> SysUtils contains only GetEnvironmentVariable, but not Set...
>>>
>>>
>>> That's not how it works on Unix/Linux.
>>>
>>> You must always set up environment variables before a program starts.
>>> When starting a process, the environment for that process is started and
>>> is
>>> then immutable for the duration of the process.
>>
>>
>> (and even if you manage to change the copy of the process, the libraries
>> startup code will have already been run before you make that change to the
>> copy of the environment)
>
>
> Hence the 'immutable'...
>
> Michael.
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list