new_process.InheritHandles := False;
new_process.Options := [];
new_process.ShowWindow := swoShow;
for env_count := 1 to GetEnvironmentVariableCount do
new_process.Environment.Add(GetEnvironmentString(env_count));
Are these lines really required? Because in my oppinion they shouldn't.
ShowWindow is afaik windows only. Linux does not have a concept of GUI applications therefore there is no point in such an option.
Options should be initialized empty
About InheritHandles, while execve or posix_spawn (don't know what TProcess internally uses, I hope it's posix_spawn, but for this doesn't matter) does not close all filedescriptors, unless you are forkchaining your application (that means that every process spawns a new child process before it dies) you should not run into any problems if you don't do this (that said, if you forkchain, not doing this will fire back hard). Lastly the Environment variables, if you don't specify any environment variables, it should inherit the ones from the parent. Only if you want to modify them you need to copy them.
For example:
var
p: TProcess;
begin
p:= TProcess.Create(nil);
p.Executable:='/usr/bin/env';
p.Execute;
end.
Prints all environment variables of the parent process. But adding a "p.Environment.Values['foo'] := 'bar';" before the execute line, will result in having only that single environment variable set
So your code reduces to:
with TProcess.Create do
try
ExecName := ParamStr(0); // a more portable way, you might not always have an application object available
Execute;
finally
Free;
end;