simple_process

Lightweight Process Execution for Eiffel

Foundation Layer v1.0.0 MIT

Overview

simple_process provides a simple wrapper for executing shell commands and capturing their output. It replaces heavier framework dependencies with a minimal, focused implementation.

Part of the simple_* ecosystem of focused, single-purpose Eiffel libraries.

Quick Start

Installation

<library name="simple_process" location="$SIMPLE_PROCESS\simple_process.ecf"/>

Basic Usage

local
    helper: SIMPLE_PROCESS_HELPER
    output: STRING_32
do
    create helper

    -- Execute command and capture output
    output := helper.output_of_command ("cmd /c dir", Void)
    print (output)

    -- Check if executable exists in PATH
    if helper.has_file_in_path ("git.exe") then
        print ("Git is installed%N")
    end
end

Process Visibility

-- Hide process window (default)
helper.set_show_process (False)

-- Show process window
helper.set_show_process (True)

Features

Command Execution

Execute shell commands and capture output

PATH Checking

Check if executables exist in system PATH

Process Visibility

Configure hidden or visible process windows

Wait Modes

Wait or no-wait execution modes

API Reference

output_of_command (a_command_line, a_directory): STRING_32

output := helper.output_of_command ("cmd /c dir", Void)

Execute command and return captured output. If directory is Void, uses current directory.

Require

cmd_not_empty: not a_command_line.is_empty

has_file_in_path (a_name: STRING): BOOLEAN

if helper.has_file_in_path ("git.exe") then ...

Check if file exists in system PATH.

Configuration

FeatureDescription
show_processWhether to show process window (default: False)
set_show_process (value)Set process visibility
is_wait_for_exitWhether to wait for process (default: True)
set_wait_for_exitEnable waiting for process exit
set_do_not_wait_for_exitDisable waiting for process exit

Error Handling

FeatureDescription
last_errorLast error code from process execution
last_error_resultLast error message from process execution