.. | ||
example.dart | ||
process_example.dart | ||
process_examples.dart | ||
process_examples_test.dart | ||
pubspec.yaml | ||
README.md |
Process Package Examples
This directory contains examples demonstrating the usage of the Process package.
Running the Examples
# Get dependencies
dart pub get
# Run the example
dart run example.dart
Examples Included
-
Basic Process Execution
- Simple command execution with
echo
- Output capturing and handling
- Basic process configuration
- Simple command execution with
-
Process Configuration
- Working directory configuration with
path()
- Environment variables with
env()
- Output suppression with
quietly()
- Process timeouts and idle timeouts
- Working directory configuration with
-
Process Pool
- Concurrent process execution
- Pool result handling
- Real-time output capturing
- Process coordination
-
Process Pipe
- Sequential process execution
- Output piping between processes
- Command chaining
- Error handling in pipelines
-
Error Handling
- Process failure handling
- Exception catching and handling
- Error output capturing
- Custom error callbacks
-
Testing
- Process faking with
fake()
- Output sequence simulation
- Timing simulation
- Process behavior mocking
- Process faking with
Additional Examples
For more specific examples, see:
- Process Execution - Detailed process execution examples
- Process Coordination - Advanced pool and pipe examples
- Testing Utilities - Comprehensive testing examples
Notes
- Some examples require specific system commands (
ls
,sort
,uniq
). These commands are commonly available on Unix-like systems. - Error handling examples intentionally demonstrate failure cases.
- The testing examples show how to use the package's testing utilities in your own tests.
- Process pools demonstrate concurrent execution - actual execution order may vary.
- Process pipes demonstrate sequential execution - output flows from one process to the next.
System Requirements
- Dart SDK >= 3.0.0
- Unix-like system for some examples (Linux, macOS)
- Basic system commands (
echo
,ls
, etc.)
Best Practices Demonstrated
- Always handle process errors appropriately
- Use timeouts for long-running processes
- Configure working directories explicitly
- Set environment variables when needed
- Use
quietly()
for noisy processes - Clean up resources properly
- Test process-dependent code thoroughly