Skip to content

Commit d470d7c

Browse files
committed
Add temporary workflow to verify stdout line-ending behavior on Windows
1 parent a770650 commit d470d7c

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Verify stdout line-ending behavior
2+
3+
on:
4+
push:
5+
branches: [fix/rpc-windows-binary-mode]
6+
7+
jobs:
8+
verify:
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, windows-latest]
12+
runs-on: ${{ matrix.os }}
13+
steps:
14+
- name: Write test script
15+
shell: bash
16+
run: |
17+
cat > /tmp/test_lineendings.py << 'PYEOF'
18+
import subprocess, sys
19+
20+
text_script = r'''import sys; sys.stdout.write("Content-Length: 5\r\n\r\nhello"); sys.stdout.flush()'''
21+
binary_script = r'''import sys, os; os.write(sys.stdout.fileno(), b"Content-Length: 5\r\n\r\nhello")'''
22+
23+
text = subprocess.run([sys.executable, "-c", text_script], capture_output=True)
24+
binary = subprocess.run([sys.executable, "-c", binary_script], capture_output=True)
25+
26+
print(f"text mode: {text.stdout!r}")
27+
print(f"binary mode: {binary.stdout!r}")
28+
print(f"match: {text.stdout == binary.stdout}")
29+
30+
if text.stdout != binary.stdout:
31+
print("MISMATCH DETECTED - text mode corrupts line endings on this platform")
32+
sys.exit(1)
33+
PYEOF
34+
35+
- name: Compare sys.stdout.write vs os.write
36+
shell: bash
37+
run: python /tmp/test_lineendings.py

0 commit comments

Comments
 (0)