Skip to content

Commit 9440c95

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

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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: Compare sys.stdout.write vs os.write
15+
run: |
16+
python -c "
17+
import subprocess, sys
18+
19+
text_mode_script = 'import sys; sys.stdout.write(\"Content-Length: 5\r\n\r\nhello\"); sys.stdout.flush()'
20+
binary_mode_script = 'import sys, os; os.write(sys.stdout.fileno(), b\"Content-Length: 5\r\n\r\nhello\")'
21+
22+
text = subprocess.run([sys.executable, '-c', text_mode_script], capture_output=True)
23+
binary = subprocess.run([sys.executable, '-c', binary_mode_script], capture_output=True)
24+
25+
print(f'text mode: {text.stdout!r}')
26+
print(f'binary mode: {binary.stdout!r}')
27+
print(f'match: {text.stdout == binary.stdout}')
28+
29+
if text.stdout != binary.stdout:
30+
print('MISMATCH DETECTED - text mode corrupts line endings on this platform')
31+
sys.exit(1)
32+
"

0 commit comments

Comments
 (0)