Recent

Author Topic: A question about TProcess, .CommandLine etc.  (Read 4162 times)

Anonymous

  • Guest
A question about TProcess, .CommandLine etc.
« on: December 29, 2005, 03:10:54 pm »
Hi, I hope to not be too off topic here.
I'm building a cross platform application with Lazarus that will call some external executables that will be spawned from the main Lazarus application as TProcess.
Wit .CommandLine I can specify the command like to pass to the executables but unfortunately I'll have to pass as parameters (potentially) a list of thousands qualified filenames, so it will result a really LONG command line.
Being the application multiplatform I may incour, AFAIK, in several problems: various length of command tail length allowed by the various operating systems, length of command line allowed by the various command interpreter (usually shorter), and moreover, I wonder, will I incour in some other limits in command line length allowed by the Lazarus IDE to be passed as (name of process variable).CommandLine?
Not all the external executables I'll call can read the command line parameters form a saved external file, so I cannot even save a file with parameters and then pass them to the executables.
The only solution I see is to check the .CommandLine length and if it exceed a certain value split the command line in more command lines and then run sequentially more instance of the command, it will lead almost to the same result than ideally running the command with all the parameters in a single huge command line, however, "almost" so I would prefer to do it in a single pass calling the executable with the whole big list of parameters if only it's possible...
Can someone please help me in understyanding better how can I pass an huge amount of parateres to an external executable with Lazarus/FreePascal and otherwise, if I can't, if Lazarus/FreePascal pose some utter limitation in the size of the command line I could pass to an external executable?
Thank you a lot in advance!
 Giorgio

SergKam

  • New Member
  • *
  • Posts: 29
RE: A question about TProcess, .CommandLine etc.
« Reply #1 on: January 03, 2006, 10:07:29 am »
Yes. Lenght of command line is limited.32000 in linux and ~2Kb-dos. Beter use pipe. Chaild process may read from stdin.
Excuse for my English

 

TinyPortal © 2005-2018