TProcess: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: TProcess
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **TProcess**  is a non-visual component on the [[System tab]] of the [[Component Palette]] that enables easy execution of external programs. | |
| 2 | + | ||
| 3 | + | Some of the benefits of using TProcess are that it is: | |
| 4 | + | ||
| 5 | + | - Platform Independent | |
| 6 | + | - Capable of reading from stdout and writing to stdin. | |
| 7 | + | - Possible to wait for a command to finish or let it run while your program moves on. | |
| 8 | + | ||
| 9 | + | Important notes: | |
| 10 | + | ||
| 11 | + | - TProcess is not a terminal/shell! You cannot directly execute scripts or redirect output using operators like "\|", "\>", "\<", "&" etc. It is possible to obtain the same results with TProcess using pascal, some examples are below.. | |
| 12 | + | - Presumably on Linux/Unix: you **must** specify the full path to the executable. For example '/bin/cp' instead of 'cp'. If the program is in the standard PATH then you can use the function [[doc:lcl/fileutil/finddefaultexecutablepath.html|FindDefaultExecutablePath]] from the [[doc:lcl/fileutil/index.html|FileUtil]] unit of the LCL. | |
| 13 | + | - On Windows, if the command is on the path, you don't need to specify the full path. | |
| 14 | + | ||
| 15 | + | ## Example | |
| 16 | + | ||
| 17 | + | See the TProcess examples in [[Executing External Programs]]. | |
| 18 | + | ||
| 19 | + | If there is need for [[UTF-8]] string passing, use TProcessUTF8 instead. | |
| 20 | + | ||
| 21 | + | ## Ported To Delphi | |
| 22 | + | ||
| 23 | + | TProcess has also been ported to work on Delphi (currently on MS Windows, soon macOS also). | |
| 24 | + | ||
| 25 | + | The delphi port is being worked on here: | |
| 26 | + | ||
| 27 | + | <https://github.com/z505/TProcess-Delphi> | |
| 28 | + | ||
| 29 | + | ## See also | |
| 30 | + | ||
| 31 | + | - [[doc:fcl/process/tprocess.html|TProcess doc]] | |
| 32 | + | - [[TAsyncProcess]] | |
| 33 | + | - [[TProcessUTF8]] | |
| 34 | + | ||
| 35 | + | --- | |
| 36 | + | *From the Free Pascal wiki, page "TProcess", as it stood on 2021-10-27 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
