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
| Feature | Description |
|---|---|
show_process | Whether to show process window (default: False) |
set_show_process (value) | Set process visibility |
is_wait_for_exit | Whether to wait for process (default: True) |
set_wait_for_exit | Enable waiting for process exit |
set_do_not_wait_for_exit | Disable waiting for process exit |
Error Handling
| Feature | Description |
|---|---|
last_error | Last error code from process execution |
last_error_result | Last error message from process execution |