# TSK-0041: Complete SubprocessRunner Migration

**Type**: Task
**Status**: Open
**Priority**: High
**Assignee**: Engineer Agent
**Created**: 2025-07-24
**Epic**: Utility Module Integration Phase 3

## Description

Replace all remaining direct `subprocess.*` calls with SubprocessRunner to ensure consistent subprocess execution, error handling, and output streaming across the codebase.

## Acceptance Criteria

- [ ] Replace `subprocess.Popen` in `hook_service_manager.py`
- [ ] Replace all subprocess calls in `version_control/conflict_resolution.py`
- [ ] Replace all subprocess calls in `version_control/git_operations.py`
- [ ] Update test files to use SubprocessRunner where appropriate
- [ ] Ensure all subprocess operations have proper timeout handling
- [ ] Maintain streaming output capability where needed

## Technical Details

### Target Files:
1. **hook_service_manager.py** (line 148):
   - Current: `subprocess.Popen` for hook service process
   - Needs: Async subprocess handling with proper cleanup

2. **version_control/conflict_resolution.py** (line 229):
   - Current: `subprocess.run` for git commands
   - Needs: Error handling and output capture

3. **version_control/git_operations.py**:
   - Multiple subprocess calls for git operations
   - Needs: Consistent error handling and streaming

### Implementation Example:
```python
# Before:
result = subprocess.run(['git', 'status'], capture_output=True, text=True)

# After:
from claude_mpm.utils.subprocess_runner import SubprocessRunner
runner = SubprocessRunner()
result = runner.run_command(['git', 'status'])
```

## Dependencies
- SubprocessRunner from `claude_mpm.utils.subprocess_runner`
- No breaking changes to existing APIs

## Testing Requirements
- Test all migrated subprocess calls
- Verify error handling improvements
- Test timeout functionality
- Ensure streaming output works correctly
- Add integration tests for git operations

## Success Metrics
- Zero direct subprocess imports outside SubprocessRunner
- Improved error handling coverage
- Consistent timeout behavior across all subprocess operations