mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 23:28:30 +00:00
- Create cross-platform subprocess utility with Windows shell=True support - Update all CLI commands to use new subprocess utility instead of direct subprocess.run() - Add comprehensive tests for Windows compatibility scenarios - Fixes #3522: Access denied errors on Windows CLI execution The core issue was that Windows with restrictive security policies blocks subprocess execution when shell=False (the default). Using shell=True on Windows allows commands to execute through the Windows shell, which typically has the necessary permissions. Files updated: - src/crewai/cli/subprocess_utils.py (new utility) - tests/cli/test_subprocess_utils.py (new tests) - All CLI files that use subprocess.run(): run_crew.py, kickoff_flow.py, install_crew.py, train_crew.py, evaluate_crew.py, replay_from_task.py, plot_flow.py, tools/main.py, git.py The solution maintains existing behavior on Unix-like systems while providing Windows compatibility through platform detection. Co-Authored-By: João <joao@crewai.com>
28 lines
746 B
Python
28 lines
746 B
Python
import subprocess
|
|
|
|
import click
|
|
|
|
from crewai.cli.subprocess_utils import run_command
|
|
|
|
|
|
def replay_task_command(task_id: str) -> None:
|
|
"""
|
|
Replay the crew execution from a specific task.
|
|
|
|
Args:
|
|
task_id (str): The ID of the task to replay from.
|
|
"""
|
|
command = ["uv", "run", "replay", task_id]
|
|
|
|
try:
|
|
result = run_command(command, capture_output=False, text=True, check=True)
|
|
if result.stderr:
|
|
click.echo(result.stderr, err=True)
|
|
|
|
except subprocess.CalledProcessError as e:
|
|
click.echo(f"An error occurred while replaying the task: {e}", err=True)
|
|
click.echo(e.output, err=True)
|
|
|
|
except Exception as e:
|
|
click.echo(f"An unexpected error occurred: {e}", err=True)
|