Skip to content

Commit 60f18d0

Browse files
claudemldangelo
andcommitted
fix: explicitly pass stdio to subprocess to avoid blocking
Fixes errno 35 (EAGAIN - Resource temporarily unavailable) by explicitly passing stdin, stdout, stderr to subprocess.run(). This ensures proper I/O handling and prevents resource blocking issues on all platforms. Error was: 'ERROR: Failed to execute promptfoo: [Errno 35] Resource temporarily unavailable' Co-Authored-By: Michael D'Angelo <michael@promptfoo.dev>
1 parent 5247d98 commit 60f18d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/promptfoo/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,13 @@ def main() -> NoReturn:
7474

7575
try:
7676
# Execute the command with shell=False (more secure)
77-
# Pass through stdio so the user interacts directly with promptfoo
77+
# Explicitly pass stdin, stdout, stderr to avoid resource blocking issues
7878
result = subprocess.run(
7979
cmd,
8080
env=os.environ.copy(),
81+
stdin=sys.stdin,
82+
stdout=sys.stdout,
83+
stderr=sys.stderr,
8184
check=False, # Don't raise exception on non-zero exit
8285
shell=False, # Always False - more secure
8386
)

0 commit comments

Comments
 (0)