Skip over navigation

Console Application Runner Classes

Execute child processes and redirect their I/O

Version 3.1.0
Released 2014-08-11
Platforms Win32 & Win64
Framework RTL
Compatibilty Delphi 7 & later

Overview

The Console Application Runner classes are designed to be used to control the execution of child console application processes. There are two classes: a class named TPJCustomConsoleApp that is provided as a base class for user-defined sub-classes, and TPJConsoleApp that is used to provide a general way to run and manipulate console applications. Both classes are provided in a single unit, PJConsoleApp.

The classes enable the console application's standard input, standard output and standard error to be redirected to and from files or pipes. They can also timeslice the running of the console application to enable the calling application to continue processing in parallel and to enable redirected output to be processed.

The classes come with numerous demo programs that illustrate how to use the them. Each demo is related to an example documented in the documentation. There is a VCL version of each demo and a few demos also have FireMonkey 2 versions as well.

Please note that some of the demos use units and classes from the DelphiDabbler IO Utility Classes project. Before attempting to compile the affected demos you need to download this project and copy the required units to the Demos\IOUtils directory.

Users of Delphi XE5 and later must use IO Utility Classes v1.0.1 or later.

For more information see the file README.txt in the Demos directory of the download.

As of v3.0 the TPJPipe, TPJPipeFilters & TPJFileHandle classes were removed from the project into I/O Utility Classes.

Get The Code

You can download the latest version of the Console Application Runner Classes directly from SourceForge as dd-consoleapp-3.1.0.zip.

Download v3.1.0

The Console Application Runner Classes source code is hosted in the ddablib/consoleapp GitHub repository. You can git clone or fork the repository as required.

Installation

The Console Application Runner Classes are supplied in a zip file. Before installing you need to extract all the files from the zip file, preserving the directory structure. The following files will be extracted:

  • PJConsoleApp.pas – source code.
  • ReadMe.htm – read-me file.
  • ChangeLog.txt – project change log.
  • MPL-2.txt – the Mozilla Public License v2.0.
  • Documentation.URL – short-cut to the component's online documentation.

In addition to the above files you will find numerous demo projects in the Demos sub-directory.

There are three possible ways to use the units.

  1. The simplest way is to add PJConsoleApp.pas to your projects as and when you need it.
  2. To make the unit easier to re-use you can either copy it to a folder on your Delphi search path, or add the folder where you extracted the unit to the search path. You then simply use the unit as required without needing to add them to your project.
  3. For maximum portability you can add the unit to a Delphi design time package. If you need help doing this see here.

Documentation

The Console Application Runner Classes are comprehensively documented online here

The project's change log can be viewed here.

A read-me file (ReadMe.htm) is included in the project download.

The is also an FAQ.

Feedback & Queries

If you find any bugs or want to suggest a new feature please report them using the Console Application Runner Classes issue tracker.

If you have created a bug fix or have implemented a new feature please open a pull request for it.

Should you have any queries about using the classes please read the documentation and/or FAQ. If you can't find an answer in the documentation then post a message in the discussion group.

License

The Console Application Runner Classes are open source. They are copyright © 2007-2014 by Peter Johnson. The source code is made available under the terms of the Mozilla Public License v2.0. All relevant trademarks are acknowledged.