Lazarus

Free Pascal => FPC development => Topic started by: mm7 on July 08, 2020, 12:24:54 am

Title: Why to hide ErrorString ????
Post by: mm7 on July 08, 2020, 12:24:54 am
Guys, what was a purpose to hide ErrorString and not to include it in params?

process.pp
Code: Pascal  [Select][+][-]
  1. function RunCommandIndir(const curdir:string;const exename:string;const commands:array of string;out outputstring:string;out exitstatus:integer; Options : TProcessOptions = []):integer;
  2. Var
  3.     p : TProcess;
  4.     i : integer;
  5.     ErrorString : String;
  6. begin
  7.   p:=TProcess.create(nil);
  8.   if Options<>[] then
  9.     P.Options:=Options - ForbiddenOptions;
  10.   p.Executable:=exename;
  11.   if curdir<>'' then
  12.     p.CurrentDirectory:=curdir;
  13.   if high(commands)>=0 then
  14.    for i:=low(commands) to high(commands) do
  15.      p.Parameters.add(commands[i]);
  16.   result:=internalruncommand(p,outputstring,errorstring,exitstatus);
  17. end;    
  18.  

Now I need to repeat this function in my code

And internalruncommand(...) is also hidden!
So I need to repeat it as well ... :(
Title: Re: Why to hide ErrorString ????
Post by: Bart on July 08, 2020, 10:39:45 am
Well, then simply use TProcess?

Bart
TinyPortal © 2005-2018